[Rt-commit] rt branch, 4.4/rest-watcher-id, created. rt-4.4.1-1-gc9cd54b

Shawn Moore shawn at bestpractical.com
Thu May 4 14:42:20 EDT 2017


The branch, 4.4/rest-watcher-id has been created
        at  c9cd54b6085549bf01984005d8f5c6727d90a1db (commit)

- Log -----------------------------------------------------------------
commit c9cd54b6085549bf01984005d8f5c6727d90a1db
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu May 4 18:40:37 2017 +0000

    Support managing groups as watchers in REST
    
    By specifying a numeric ID rather than an email address, you can now
    add/remove a group as a ticket watcher over REST 1.0
    
    Fixes: T#185062

diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index d4dbd9c..819d69e 100644
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -366,15 +366,20 @@ else {
 
             foreach $p (keys %old) {
                 unless (exists $new{$p}) {
+                    my $key = "Email";
+                    $key = "PrincipalId" if $p =~ /^\d+$/;
+
                     ($s, $n) = $ticket->DeleteWatcher(Type => $type,
-                                                      Email => $p);
+                                                      $key => $p);
                     push @msgs, [ $s, $n ];
                 }
             }
             foreach $p (keys %new) {
-                unless ($ticket->IsWatcher(Type => $type, Email => $p)) {
+                my $key = "Email";
+                $key = "PrincipalId" if $p =~ /^\d+$/;
+                unless ($ticket->IsWatcher(Type => $type, $key => $p)) {
                     ($s, $n) = $ticket->AddWatcher(Type => $type,
-                                                   Email => $p);
+                                                   $key => $p);
                     push @msgs, [ $s, $n ];
                 }
             }

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


More information about the rt-commit mailing list