[Rt-commit] rt branch 5.0/importer-dashboards created. rt-5.0.3-126-ga83f4b0e70

BPS Git Server git at git.bestpractical.com
Tue Oct 18 20:33:50 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/importer-dashboards has been created
        at  a83f4b0e7054f9a86f69b3ff9f9b7bb2a826abb2 (commit)

- Log -----------------------------------------------------------------
commit a83f4b0e7054f9a86f69b3ff9f9b7bb2a826abb2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 19 04:00:35 2022 +0800

    No need to sync attribute links in PostInflateFixup
    
    This is to avid errors like:
    
        duplicate key value violates unique constraint "links1"
    
    because related links will be imported from serialized data.

diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index 21a3df3fc8..db2ee9fa51 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -303,7 +303,8 @@ sub _SerializeContent {
 
 sub SetContent {
     my $self = shift;
-    my $content = shift;
+    my %args = ( Content => undef, SyncLinks => 1, @_ % 2 ? ( Content => @_ ) : @_ );
+    my $content = $args{Content};
 
     # Call __Value to avoid ACL check.
     if ( ($self->__Value('ContentType')||'') eq 'storable' ) {
@@ -316,7 +317,7 @@ sub SetContent {
     }
     my ($ok, $msg) = $self->_Set( Field => 'Content', Value => $content );
     if ($ok) {
-        $self->_SyncLinks;
+        $self->_SyncLinks if $args{SyncLinks};
         return ( $ok, $self->loc("Attribute updated") );
     }
     return ($ok, $msg);
@@ -909,7 +910,7 @@ sub PostInflateFixup {
                 }
             }
         }
-        $self->SetContent($content);
+        $self->SetContent( $content, SyncLinks => 0 );
     }
     elsif ( $self->Name =~ /DefaultDashboard$/ ) {
         my $content = $self->Content;
@@ -953,7 +954,7 @@ sub PostInflateFixup {
                 }
             }
         }
-        $self->SetContent($content);
+        $self->SetContent( $content, SyncLinks => 0 );
     }
     elsif ($self->Name eq 'Subscription') {
         my $content = $self->Content;
@@ -970,7 +971,7 @@ sub PostInflateFixup {
                 );
             }
         }
-        $self->SetContent($content);
+        $self->SetContent( $content, SyncLinks => 0 );
     }
 }
 

commit f9567b36f8c73b554945800a12473bed38b8d400
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 19 03:37:50 2022 +0800

    Do not skip importing system dashboards
    
    There is no reason to skip them.

diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index d8d2db1434..21a3df3fc8 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -862,8 +862,8 @@ sub PreInflate {
         my $on_uid = ${ $data->{Object} };
 
         # skip attributes of objects we're not inflating
-        # exception: we don't inflate RT->System, but we want RT->System's searches
-        unless ($on_uid eq RT->System->UID && $data->{Name} =~ /Search/) {
+        # exception: we don't inflate RT->System, but we want RT->System's searches and dashboards
+        unless ($on_uid eq RT->System->UID && $data->{Name} =~ /Search|Dashboard/) {
             return if $importer->ShouldSkipTransaction($on_uid);
         }
     }

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list