diff options
author | sunnavy <sunnavy@bestpractical.com> | 2022-10-18 23:00:35 +0300 |
---|---|---|
committer | sunnavy <sunnavy@bestpractical.com> | 2022-11-08 04:10:31 +0300 |
commit | 0f4d61e02a505f01a6a396594a00249c714cef09 (patch) | |
tree | 204a384d98ce06f11a3922b91d68c3df1203a028 | |
parent | e13a26809ba39ead098266a5ca77248ef32fa3ef (diff) |
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.
-rw-r--r-- | lib/RT/Attribute.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm index d8d2db1434..a30c63f11c 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 ); } } |