[Rt-commit] rt branch, 4.4/bulk-update-clear-roles, created. rt-4.4.4-550-g0e9fbc695c
Steve Burr
steve at bestpractical.com
Mon Jun 21 15:43:07 EDT 2021
The branch, 4.4/bulk-update-clear-roles has been created
at 0e9fbc695c913172ec592a059ec9afdaac43a26a (commit)
- Log -----------------------------------------------------------------
commit 0e9fbc695c913172ec592a059ec9afdaac43a26a
Author: Steven Burr <steve at bestpractical.com>
Date: Mon Jun 21 14:52:02 2021 -0400
Allow clearing roles on bulk updates page
The bulk update page currently allows one to specify specific
principals to add/remove to/from ticket roles, but there is no
way to completely clear all members from a role without knowing
all of their identities in advance.
This change adds a checkbox to optionally clear each core and/or
custom role.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 41d937ed9a..4b294363d5 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3607,6 +3607,23 @@ sub ProcessTicketWatchers {
push @results, $msg;
}
+ # Clear all watchers in the simple style demanded by the bulk manipulator
+ elsif ( $key =~ /^Clear(Requestor|Cc|AdminCc|RT::CustomRole-\d+)$/ ) {
+ my ( $role_group, $msg ) = $Ticket->RoleGroup($1);
+ if ( $role_group ) {
+ while (my $group_member = $role_group->MembersObj->Next) {
+ my ( $code, $msg ) = $Ticket->DeleteWatcher(
+ PrincipalId => $group_member->MemberId,
+ Type => $1
+ );
+ push @results, $msg;
+ }
+ } else {
+ RT::Logger->error("Could not load RoleGroup for $1");
+ push @results, $msg;
+ }
+ }
+
# Add new watchers by email address
elsif ( ( $ARGSRef->{$key} || '' ) =~ /^(?:AdminCc|Cc|Requestor|RT::CustomRole-\d+)$/
and $key =~ /^WatcherTypeEmail(\d*)$/ )
diff --git a/share/html/Search/Bulk.html b/share/html/Search/Bulk.html
index e5be348696..89b08084f2 100644
--- a/share/html/Search/Bulk.html
+++ b/share/html/Search/Bulk.html
@@ -86,14 +86,20 @@
<td class="value"> <& /Elements/EmailInput, Name => "AddRequestor", Size=> 20, Default => $ARGS{AddRequestor}, AutocompleteType => 'Principals' &> </td></tr>
<tr><td class="label"> <&|/l&>Remove Requestor</&>: </td>
<td class="value"> <& /Elements/EmailInput, Name => "DeleteRequestor", Size=> 20, Default => $ARGS{DeleteRequestor}, AutocompleteType => 'Principals' &> </td></tr>
+<tr><td class="label"> <&|/l&>Clear Requestor</&>: </td>
+<td class="value"> <input type="checkbox" id="ClearRequestor" class="checkbox custom-control-input" name="ClearRequestor" <% $ARGS{ClearRequestor} ? 'checked="checked"' : '' %> /></td></tr>
<tr><td class="label"> <&|/l&>Add Cc</&>: </td>
<td class="value"> <& /Elements/EmailInput, Name => "AddCc", Size=> 20, Default => $ARGS{AddCc}, AutocompleteType => 'Principals' &> </td></tr>
<tr><td class="label"> <&|/l&>Remove Cc</&>: </td>
<td class="value"> <& /Elements/EmailInput, Name => "DeleteCc", Size=> 20, Default => $ARGS{DeleteCc}, AutocompleteType => 'Principals' &> </td></tr>
+<tr><td class="label"> <&|/l&>Clear Cc</&>: </td>
+<td class="value"> <input type="checkbox" id="ClearCc" class="checkbox custom-control-input" name="ClearCc" <% $ARGS{ClearCc} ? 'checked="checked"' : '' %> /></td></tr>
<tr><td class="label"> <&|/l&>Add AdminCc</&>: </td>
<td class="value"> <& /Elements/EmailInput, Name => "AddAdminCc", Size=> 20, Default => $ARGS{AddAdminCc}, AutocompleteType => 'Principals' &> </td></tr>
<tr><td class="label"> <&|/l&>Remove AdminCc</&>: </td>
<td class="value"> <& /Elements/EmailInput, Name => "DeleteAdminCc", Size=> 20, Default => $ARGS{DeleteAdminCc}, AutocompleteType => 'Principals' &> </td></tr>
+<tr><td class="label"> <&|/l&>Clear AdminCc</&>: </td>
+<td class="value"> <input type="checkbox" id="ClearAdminCc" class="checkbox custom-control-input" name="ClearAdminCc" <% $ARGS{ClearAdminCc} ? 'checked="checked"' : '' %> /></td></tr>
% my $single_roles = RT::CustomRoles->new($session{CurrentUser});
% $single_roles->LimitToSingleValue;
@@ -117,6 +123,10 @@
<td class="label"> <&|/l, $role->Name &>Remove [_1]</&>: </td>
<td class="value"> <& /Elements/MultiUserRoleInput, role => $role, Name => "DeleteRT::CustomRole-" . $role->Id, Size => 20, Default => $ARGS{"DeleteRT::CustomRole-" . $role->Id}, AutocompleteMultiple => 0 &> </td>
</tr>
+<tr>
+<td class="label"> <&|/l, $role->Name &>Clear [_1]</&>:</td>
+<td class="value"><input type="checkbox" id="ClearRT::CustomRole-<% $role->Id %>" class="checkbox custom-control-input" name="ClearRT::CustomRole-<% $role->Id %>" <% $ARGS{"ClearRT::CustomRole-" . $role->Id} ? 'checked="checked"' : '' %> /></td>
+</tr>
% }
</table>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list