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

BPS Git Server git at git.bestpractical.com
Fri Aug 18 16:59:25 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  4a32e18596275a7f6eb24b8710037de111e1772a (commit)

- Log -----------------------------------------------------------------
commit 4a32e18596275a7f6eb24b8710037de111e1772a
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..5d43081f5b 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">
+      <&|/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 it on [_1] page.</&>
+%     }
+    </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