[Rt-commit] rt branch, 4.0/name-principal-in-msg, created. rt-4.0.7-62-gb29757e

? sunnavy sunnavy at bestpractical.com
Sat Sep 29 13:31:05 EDT 2012


The branch, 4.0/name-principal-in-msg has been created
        at  b29757e7d2df67bc23afaa602000566bdc38e525 (commit)

- Log -----------------------------------------------------------------
commit b29757e7d2df67bc23afaa602000566bdc38e525
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Sep 30 01:26:24 2012 +0800

    pricipal name is more clear than literal "principal" in return message
    
    see also #21101

diff --git a/lib/RT/ACE.pm b/lib/RT/ACE.pm
index ae3eda4..c878a2d 100644
--- a/lib/RT/ACE.pm
+++ b/lib/RT/ACE.pm
@@ -285,7 +285,8 @@ sub Create {
                        ObjectId      => $args{'ObjectId'},
                    );
     if ( $self->Id ) {
-        return ( 0, $self->loc('That principal already has that right') );
+        return ( 0, $self->loc('[_1] already has that right',
+                    $princ_obj->Object->Name) );
     }
 
     my $id = $self->SUPER::Create( PrincipalId   => $princ_obj->id,
diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index 406df92..a3cdd5b 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -947,7 +947,8 @@ sub _AddWatcher {
 
     if ( $group->HasMember( $principal)) {
 
-        return ( 0, $self->loc('That principal is already a [_1] for this queue', $args{'Type'}) );
+        return ( 0, $self->loc('[_1] is already a [_2] for this queue',
+                    $principal->Object->Name, $args{'Type'}) );
     }
 
 
@@ -955,7 +956,8 @@ sub _AddWatcher {
     unless ($m_id) {
         $RT::Logger->error("Failed to add ".$principal->Id." as a member of group ".$group->Id.": ".$m_msg);
 
-        return ( 0, $self->loc('Could not make that principal a [_1] for this queue', $args{'Type'}) );
+        return ( 0, $self->loc('Could not make [_1] a [_2] for this queue',
+                    $principal->Object->Name, $args{'Type'}) );
     }
     return ( 1, $self->loc("Added [_1] to members of [_2] for this queue.", $principal->Object->Name, $args{'Type'} ));
 }
@@ -1027,8 +1029,8 @@ sub DeleteWatcher {
     # see if this user is already a watcher.
 
     unless ( $group->HasMember($principal)) {
-        return ( 0,
-        $self->loc('That principal is not a [_1] for this queue', $args{'Type'}) );
+        return ( 0, $self->loc('[_1] is not a [_2] for this queue',
+            $principal->Object->Name, $args{'Type'}) );
     }
 
     my ($m_id, $m_msg) = $group->_DeleteMember($principal->Id);
@@ -1036,7 +1038,8 @@ sub DeleteWatcher {
         $RT::Logger->error("Failed to delete ".$principal->Id.
                            " as a member of group ".$group->Id.": ".$m_msg);
 
-        return ( 0,    $self->loc('Could not remove that principal as a [_1] for this queue', $args{'Type'}) );
+        return ( 0, $self->loc('Could not remove [_1] as a [_2] for this queue',
+                    $principal->Object->Name, $args{'Type'}) );
     }
 
     return ( 1, $self->loc("Removed [_1] from members of [_2] for this queue.", $principal->Object->Name, $args{'Type'} ));
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index bddb48a..be3f5c6 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -1140,7 +1140,8 @@ sub _AddWatcher {
 
     if ( $group->HasMember( $principal)) {
 
-        return ( 0, $self->loc('That principal is already a [_1] for this ticket', $self->loc($args{'Type'})) );
+        return ( 0, $self->loc('[_1] is already a [_2] for this ticket',
+                    $principal->Object->Name, $self->loc($args{'Type'})) );
     }
 
 
@@ -1149,7 +1150,8 @@ sub _AddWatcher {
     unless ($m_id) {
         $RT::Logger->error("Failed to add ".$principal->Id." as a member of group ".$group->Id.": ".$m_msg);
 
-        return ( 0, $self->loc('Could not make that principal a [_1] for this ticket', $self->loc($args{'Type'})) );
+        return ( 0, $self->loc('Could not make [_1] a [_2] for this ticket',
+                    $principal->Object->Name, $self->loc($args{'Type'})) );
     }
 
     unless ( $args{'Silent'} ) {
@@ -1160,7 +1162,8 @@ sub _AddWatcher {
         );
     }
 
-        return ( 1, $self->loc('Added principal as a [_1] for this ticket', $self->loc($args{'Type'})) );
+    return ( 1, $self->loc('Added [_1] as a [_2] for this ticket',
+                $principal->Object->Name, $self->loc($args{'Type'})) );
 }
 
 
@@ -1259,8 +1262,8 @@ sub DeleteWatcher {
 
     unless ( $group->HasMember($principal) ) {
         return ( 0,
-                 $self->loc( 'That principal is not a [_1] for this ticket',
-                             $args{'Type'} ) );
+                 $self->loc( '[_1] is not a [_2] for this ticket',
+                             $principal->Object->Name, $args{'Type'} ) );
     }
 
     my ( $m_id, $m_msg ) = $group->_DeleteMember( $principal->Id );
@@ -1273,8 +1276,8 @@ sub DeleteWatcher {
 
         return (0,
                 $self->loc(
-                    'Could not remove that principal as a [_1] for this ticket',
-                    $args{'Type'} ) );
+                    'Could not remove [_1] as a [_2] for this ticket',
+                    $principal->Object->Name, $args{'Type'} ) );
     }
 
     unless ( $args{'Silent'} ) {
diff --git a/t/web/ticket_modify_all.t b/t/web/ticket_modify_all.t
index 2f0c4d1..6d19b28 100644
--- a/t/web/ticket_modify_all.t
+++ b/t/web/ticket_modify_all.t
@@ -68,7 +68,7 @@ $m->field(WatcherTypeEmail => 'Requestor');
 $m->field(WatcherAddressEmail => 'root at localhost');
 $m->click('SubmitTicket');
 $m->text_contains(
-    "Added principal as a Requestor for this ticket",
+    "Added root as a Requestor for this ticket",
     'watcher is added',
 );
 $m->form_name('TicketModifyAll');
@@ -76,7 +76,7 @@ $m->field(WatcherTypeEmail => 'Requestor');
 $m->field(WatcherAddressEmail => 'root at localhost');
 $m->click('SubmitTicket');
 $m->text_contains(
-    "That principal is already a Requestor for this ticket",
+    "root is already a Requestor for this ticket",
     'no duplicate watchers',
 );
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list