[Rt-commit] rt branch, 4.4/improve-add-custom-role-message, created. rt-4.4.2-38-g3910976e1
Maureen Mirville
maureen at bestpractical.com
Thu Feb 15 16:36:16 EST 2018
The branch, 4.4/improve-add-custom-role-message has been created
at 3910976e1318a966b629870fedf004c2a286c93a (commit)
- Log -----------------------------------------------------------------
commit 3910976e1318a966b629870fedf004c2a286c93a
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date: Wed Aug 30 10:46:17 2017 -0400
Improve message when applying/removing custom roles from queues
When a user is applying or removing a custom role from a queue, the
previous message after making a change, "Object created" or "Object
deleted" was unclear. Message updated to make it clear user applied
a role or removed a role from a queue.
Fixes: I#32695
diff --git a/lib/RT/CustomRole.pm b/lib/RT/CustomRole.pm
index 2bab3133d..745bd6697 100644
--- a/lib/RT/CustomRole.pm
+++ b/lib/RT/CustomRole.pm
@@ -411,7 +411,11 @@ sub AddToObject {
unless $queue->CurrentUserHasRight('AdminCustomRoles');
my $rec = RT::ObjectCustomRole->new( $self->CurrentUser );
- return $rec->Add( %args, CustomRole => $self );
+ my ( $status, $add ) = $rec->Add( %args, CustomRole => $self );
+ my $msg;
+ $msg = $self->loc("[_1] added to queue [_2]", $self->Name, $queue->Name) if $status;
+
+ return ( $add, $msg );
}
=head2 RemoveFromObject
@@ -444,11 +448,14 @@ sub RemoveFromObject {
return ( 0, $self->loc('Permission Denied') )
unless $queue->CurrentUserHasRight('AdminCustomRoles');
-
my $rec = RT::ObjectCustomRole->new( $self->CurrentUser );
$rec->LoadByCols( CustomRole => $self->id, ObjectId => $args{'ObjectId'} );
return (0, $self->loc('Custom role is not added') ) unless $rec->id;
- return $rec->Delete;
+ my ( $status, $delete ) = $rec->Delete;
+ my $msg;
+ $msg = $self->loc("[_1] removed from queue [_2]", $self->Name, $queue->Name) if $status;
+
+ return ( $delete, $msg );
}
=head2 SingleValue
-----------------------------------------------------------------------
More information about the rt-commit
mailing list