[Rt-commit] r6323 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Fri Oct 27 01:42:34 EDT 2006
Author: ruz
Date: Fri Oct 27 01:42:33 2006
New Revision: 6323
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Attachments_Overlay.pm
Log:
r4058 at cubic-pc: cubic | 2006-10-27 07:32:20 +0400
::Attachments->Next
* do less calls
* simplify it a little, that was crazy
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Attachments_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Attachments_Overlay.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Attachments_Overlay.pm Fri Oct 27 01:42:33 2006
@@ -143,27 +143,19 @@
# {{{ sub Next
sub Next {
my $self = shift;
-
- my $Attachment = $self->SUPER::Next();
- if ((defined($Attachment)) and (ref($Attachment))) {
- if ($Attachment->TransactionObj->__Value('Type') =~ /^Comment/ &&
- $Attachment->TransactionObj->TicketObj->CurrentUserHasRight('ShowTicketComments')) {
- return($Attachment);
- } elsif ($Attachment->TransactionObj->__Value('Type') !~ /^Comment/ &&
- $Attachment->TransactionObj->TicketObj->CurrentUserHasRight('ShowTicket')) {
- return($Attachment);
- }
- #If the user doesn't have the right to show this ticket
- else {
- return($self->Next());
- }
+ my $Attachment = $self->SUPER::Next;
+ return $Attachment unless $Attachment;
+
+ my $txn = $Attachment->TransactionObj;
+ if ( $txn->__Value('Type') eq 'Comment' ) {
+ return $Attachment if $txn->CurrentUserHasRight('ShowTicketComments');
+ } elsif ( $txn->CurrentUserHasRight('ShowTicket') ) {
+ return $Attachment;
}
- #if there never was any ticket
- else {
- return(undef);
- }
+ # If the user doesn't have the right to show this ticket
+ return $self->Next;
}
# }}}
More information about the Rt-commit
mailing list