[Bps-public-commit] rt-extension-rest2 branch, allow-updating-of-ticket-links, created. 1.07-1-gca60e6b

Craig Kaiser craig at bestpractical.com
Thu Mar 5 13:46:59 EST 2020


The branch, allow-updating-of-ticket-links has been created
        at  ca60e6b82eb6ffec79e2d12ccd77d8089a7d1b90 (commit)

- Log -----------------------------------------------------------------
commit ca60e6b82eb6ffec79e2d12ccd77d8089a7d1b90
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Thu Jun 13 14:39:05 2019 -0400

    Allow updating of ticket links
    
    Use the 'AddLink' and 'DeleteLink' keys with a link
    'type' (MemberOf DependsOn RefersTo ect) key and a
    'base' key, this can be a ticket id or a link URL.

diff --git a/lib/RT/Extension/REST2/Resource/Record/Writable.pm b/lib/RT/Extension/REST2/Resource/Record/Writable.pm.orig
similarity index 100%
rename from lib/RT/Extension/REST2/Resource/Record/Writable.pm
rename to lib/RT/Extension/REST2/Resource/Record/Writable.pm.orig
diff --git a/lib/RT/Extension/REST2/Util.pm b/lib/RT/Extension/REST2/Util.pm
index e814c1c..62f6944 100644
--- a/lib/RT/Extension/REST2/Util.pm
+++ b/lib/RT/Extension/REST2/Util.pm
@@ -145,6 +145,7 @@ sub deserialize_record {
     my $data   = shift;
 
     my $does_roles = $record->DOES("RT::Record::Role::Roles");
+    my $does_links = $record->DOES("RT::Record::Role::Links");
 
     # Sanitize input for the Perl API
     for my $field (sort keys %$data) {
@@ -167,6 +168,11 @@ sub deserialize_record {
             }
             $data->{$field} = \@members;
         }
+        elsif ( $does_links and ($field =~ /^(Add|Delete)Link$/ ) ) {
+            my @links = ref $value eq 'ARRAY'
+                ? @$value : $value;
+            $data->{$field} = \@links;
+        }
         else {
             RT->Logger->debug("Received unknown value via JSON for field $field: ".ref($value));
             delete $data->{$field};

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


More information about the Bps-public-commit mailing list