From 11e68406ceae4297492dddbce3b01a884ca8736a Mon Sep 17 00:00:00 2001 From: sunnavy Date: Fri, 21 Jan 2022 05:44:21 +0800 Subject: [PATCH] List current user in "All Recipients" if it's a watcher Previously when NotifyActor is false, even if current user is a watcher, it was not listed in "Modify who receives mail ..." widget on modify people page, which was confusing as current user would get notifications of actions made by others. This commit fixes this, with a hint to indicate that RT won't send notifications of its own actions. This also allows People to ignore specific ticket updates by unchecking themselves there. --- lib/RT/Action/Notify.pm | 4 +++- share/html/Ticket/ModifyPeople.html | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/RT/Action/Notify.pm b/lib/RT/Action/Notify.pm index f6fcbc06546..c148e67fee7 100644 --- a/lib/RT/Action/Notify.pm +++ b/lib/RT/Action/Notify.pm @@ -220,6 +220,8 @@ NotifyActor configuration, include NeverNotifyActor in the list of arguments. =cut +our $ALWAYS_NOTIFY_ACTOR = 0; + sub RemoveInappropriateRecipients { my $self = shift; @@ -237,7 +239,7 @@ sub RemoveInappropriateRecipients { }, ) if $args{NeverNotifyActor} || (!RT->Config->Get('NotifyActor',$TransactionCurrentUser) - && !$args{AlwaysNotifyActor}); + && !$args{AlwaysNotifyActor}) && !$ALWAYS_NOTIFY_ACTOR; $self->SUPER::RemoveInappropriateRecipients(); } diff --git a/share/html/Ticket/ModifyPeople.html b/share/html/Ticket/ModifyPeople.html index e6eced20855..28072e5aa61 100644 --- a/share/html/Ticket/ModifyPeople.html +++ b/share/html/Ticket/ModifyPeople.html @@ -74,7 +74,16 @@
  • > - +
  • % } @@ -114,6 +123,12 @@ } # Use the ticket's scrips to figure out the new list of recipients. +my $notify_actor = RT->Config->Get( 'NotifyActor', $session{CurrentUser} ); + +# Force to notify actor to list current user +require RT::Action::Notify; +local $RT::Action::Notify::ALWAYS_NOTIFY_ACTOR = 1; + my @txns = $Ticket->DryRun( sub { my $MIME = MIME::Entity->build( Type => "text/plain", Data => "" );