Skip to content

Commit

Permalink
List current user in "All Recipients" if it's a watcher
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sunnavy authored and cbrandtbuffalo committed Aug 22, 2023
1 parent 9d8c9b8 commit 11e6840
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/RT/Action/Notify.pm
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ NotifyActor configuration, include NeverNotifyActor in the list of arguments.
=cut

our $ALWAYS_NOTIFY_ACTOR = 0;

sub RemoveInappropriateRecipients {
my $self = shift;

Expand All @@ -237,7 +239,7 @@ sub RemoveInappropriateRecipients {
},
) if $args{NeverNotifyActor} ||
(!RT->Config->Get('NotifyActor',$TransactionCurrentUser)
&& !$args{AlwaysNotifyActor});
&& !$args{AlwaysNotifyActor}) && !$ALWAYS_NOTIFY_ACTOR;

$self->SUPER::RemoveInappropriateRecipients();
}
Expand Down
17 changes: 16 additions & 1 deletion share/html/Ticket/ModifyPeople.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,16 @@
<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>
Expand Down Expand Up @@ -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 => "" );
Expand Down

0 comments on commit 11e6840

Please sign in to comment.