[Rt-commit] rt branch 4.4/list-current-user-in-all-recipients created. rt-4.4.6-92-g11e68406ce

BPS Git Server git at git.bestpractical.com
Tue Aug 22 13:22:19 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 4.4/list-current-user-in-all-recipients has been created
        at  11e68406ceae4297492dddbce3b01a884ca8736a (commit)

- Log -----------------------------------------------------------------
commit 11e68406ceae4297492dddbce3b01a884ca8736a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jan 21 05:44:21 2022 +0800

    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.

diff --git a/lib/RT/Action/Notify.pm b/lib/RT/Action/Notify.pm
index f6fcbc0654..c148e67fee 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 e6eced2085..28072e5aa6 100644
--- a/share/html/Ticket/ModifyPeople.html
+++ b/share/html/Ticket/ModifyPeople.html
@@ -74,7 +74,16 @@ my $all_recipients_checked = (grep { !$_ } values %recips) ? 0 : 1;
   <li>
   <input type="hidden" name="autorecipient" value="<% $addr %>">
   <input type="checkbox" name="checked_recipient" id="checked_recipient_<%$addr%>" value="<%$addr%>" <% $recips{$addr} ? "checked" : "" %>>
-  <label for="checked_recipient_<%$addr%>"><& /Elements/ShowUser, Address => Email::Address->parse($addr) &></label>
+  <label for="checked_recipient_<%$addr%>"><& /Elements/ShowUser, Address => Email::Address->parse($addr) &>
+%   if ( !$notify_actor && $addr eq ($session{CurrentUser}->EmailAddress // '') ) {
+    <span class="hints"><i>
+      <&|/l&>RT won't send you mail for ticket updates you make.</&>
+%     if ( $session{CurrentUser}->HasRight( Right => 'ModifySelf', Object => RT->System ) ) {
+      <&|/l_unsafe, '<a target="_blank" href="' . RT->Config->Get('WebPath') . '/Prefs/Other.html">' . loc('Preferences') . '</a>'&>You can adjust this setting on the [_1] page.</&>
+%     }
+    </i></span>
+%   }
+  </label>
   </li>
 % }
 </ul>
@@ -114,6 +123,12 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup) {
 }
 
 # 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 => "" );

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list