[Bps-public-commit] r20211 - RT-Extension-ReportSpam/html/Ticket/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Fri Dec 11 18:02:57 EST 2009
Author: ruz
Date: Fri Dec 11 18:02:57 2009
New Revision: 20211
Modified:
RT-Extension-ReportSpam/html/Ticket/Elements/ReportSpam
Log:
* check errors, don't even try to change status when user has no rights
Modified: RT-Extension-ReportSpam/html/Ticket/Elements/ReportSpam
==============================================================================
--- RT-Extension-ReportSpam/html/Ticket/Elements/ReportSpam (original)
+++ RT-Extension-ReportSpam/html/Ticket/Elements/ReportSpam Fri Dec 11 18:02:57 2009
@@ -32,16 +32,30 @@
push @$reports, $uid;
}
if ( @$reports ) {
- $ticket->SetStatus('deleted');
- $ticket->SetAttribute(
+ if ( $ticket->CurrentUserHasRight('DeleteTicket') ) {
+ my ($status, $msg) = $ticket->SetStatus('deleted');
+ $RT::Logger->error("Couldn't delete ticket: $msg")
+ unless $status;
+ }
+ my ($status, $msg) = $ticket->SetAttribute(
Name => 'SpamReports',
Content => $reports,
);
+ $RT::Logger->error("Couldn't set attribute: $msg")
+ unless $status;
} else {
- $ticket->SetStatus('open');
- $ticket->DeleteAttribute(
- Name => 'SpamReports',
+ if ( $ticket->Status eq 'deleted'
+ && $ticket->CurrentUserHasRight('ModifyTicket')
+ ) {
+ my ($status, $msg) = $ticket->SetStatus('open');
+ $RT::Logger->error("Couldn't delete ticket: $msg")
+ unless $status;
+ }
+ my ($status, $msg) = $ticket->DeleteAttribute(
+ 'SpamReports'
);
+ $RT::Logger->error("Couldn't delete attribute: $msg")
+ unless $status;
}
$reported = !$reported;
}
More information about the Bps-public-commit
mailing list