[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-commit
Subject:    [Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.4-553-g0f6d76e972
From:       sunnavy () bestpractical ! com (? sunnavy)
Date:       2021-06-28 20:15:02
Message-ID: 20210628201502.CAF9D2418004 () booth ! bestpractical ! com
[Download RAW message or body]

The branch, 4.4-trunk has been updated
       via  0f6d76e9727d49a37fde57e555319a1eb88cf379 (commit)
       via  8cfc02a6c9f080521be6454cce849ee8787a0a06 (commit)
      from  e5dbd854deed76d12f1ec3d1dace0c66d267b7f6 (commit)

Summary of changes:
 lib/RT/Interface/Web.pm     | 22 ++++++++++++++++++++++
 share/html/Search/Bulk.html | 10 ++++++++++
 2 files changed, 32 insertions(+)

- Log -----------------------------------------------------------------
commit 8cfc02a6c9f080521be6454cce849ee8787a0a06
Author: Steven Burr <steve@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 multiple-member
    core and/or custom roles.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 41d937ed9a..acd867f7e4 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3607,6 +3607,28 @@ 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 ) {
+                my $members = $role_group->MembersObj;
+                while (my $group_member = $members->Next) {
+                    # In case the member is deleted automatically by scrips,
+                    # call HasMember to make sure the member still exists.
+                    if ( $role_group->HasMember( $group_member->MemberId ) ) {
+                        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>

commit 0f6d76e9727d49a37fde57e555319a1eb88cf379
Merge: e5dbd854de 8cfc02a6c9
Author: sunnavy <sunnavy@bestpractical.com>
Date:   Tue Jun 29 03:55:05 2021 +0800

    Merge branch '4.4/bulk-update-clear-roles' into 4.4-trunk


-----------------------------------------------------------------------
_______________________________________________
rt-commit mailing list
rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic