- unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
- $m->comp( 'Error.html',
- Why => loc("No permission to display that ticket") );
- # XXX: Why abort? then we loose footer //ruz
- $m->abort();
- }
-
- if (@results) {
- # We've done something, so we need to clear the decks to avoid
- # resubmission on refresh.
- # But we need to store Actions somewhere too, so we don't lose them.
- my $key = Digest::MD5::md5_hex(rand(1024));
- push @{ $session{"Actions"}->{$key} ||= [] }, @results;
- $session{'i'}++;
- RT::Interface::Web::Redirect( RT->Config->Get('WebURL') ."SelfService/Display.html?id=". $Ticket->id."&results=".$key);
- }
-
- my $Transactions = $Ticket->Transactions;
-
- my $attachments =
- $m->comp( '/Ticket/Elements/FindAttachments', Ticket => $Ticket );
-
- my $LinkBasicsTitle = $Ticket->CurrentUserHasRight('ModifyTicket')
- || $Ticket->CurrentUserHasRight('ReplyToTicket');
- my $title_box_link = RT->Config->Get('WebPath')."/SelfService/Update.html?id=".$Ticket->Id;
- $m->callback(CallbackName => 'BeforeDisplay', Ticket => \$Ticket, ARGSRef => \%ARGS, title_box_link => \$title_box_link);
+if ( $ARGS{'MarkAsSeen'} ) {
+ $Ticket->SetAttribute(
+ Name => 'User-'. $Ticket->CurrentUser->id .'-SeenUpTo',
+ Content => $Ticket->LastUpdated,
+ );
+ push @results, loc('Marked all messages as seen');
+}
+
+MaybeRedirectForResults(
+ Actions => \@results,
+ Path => '/SelfService/Display.html',
+ Anchor => $ARGS{'Anchor'},
+ Arguments => { 'id' => $Ticket->id },
+);
+
+my $LinkBasicsTitle = $Ticket->CurrentUserHasRight('ModifyTicket')
+ || $Ticket->CurrentUserHasRight('ReplyToTicket');
+my $title_box_link = RT->Config->Get('WebPath')."/SelfService/Update.html?id=".$Ticket->Id;
+$m->callback(CallbackName => 'BeforeDisplay', Ticket => \$Ticket, ARGSRef => \%ARGS, title_box_link => \$title_box_link);