[Rt-commit] rt 01/10: Handle global DashboardsInMenu for serializer and initialdata
sunnavy
sunnavy at bestpractical.com
Fri Jul 9 16:45:25 EDT 2021
This is an automated email from the git hooks/post-receive script.
sunnavy pushed a commit to branch 5.0/use-dashboard-for-homepage-select-ui
in repository rt.
commit f8352904d26f4db1b208a1cd23e5748a608703ac
Author: sunnavy <sunnavy at bestpractical.com>
AuthorDate: Fri Jul 9 18:41:38 2021 +0800
Handle global DashboardsInMenu for serializer and initialdata
Note that global DashboardsInMenu doesn't have "Pref-" prefix.
---
lib/RT/Attribute.pm | 6 +++---
lib/RT/Handle.pm | 3 ++-
lib/RT/Migrate/Serializer/JSON.pm | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index ba58813250..21db2c8778 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -804,7 +804,7 @@ sub FindDependencies {
$deps->Add( out => $self->Object );
# dashboards in menu attribute has dependencies on each of its dashboards
- if ($self->Name eq RT::User::_PrefName("DashboardsInMenu")) {
+ if ($self->Name =~ /^(?:Pref-)?DashboardsInMenu$/) {
my $content = $self->Content;
for my $pane (values %{ $content || {} }) {
for my $dash_id (@$pane) {
@@ -908,7 +908,7 @@ sub PostInflateFixup {
my $spec = shift;
# decode UIDs to be raw dashboard IDs
- if ($self->Name eq RT::User::_PrefName("DashboardsInMenu")) {
+ if ( $self->Name =~ /^(?:Pref-)?DashboardsInMenu$/ ) {
my $content = $self->Content;
for my $pane (values %{ $content || {} }) {
@@ -1023,7 +1023,7 @@ sub Serialize {
my %store = $self->SUPER::Serialize(@_);
# encode raw dashboard IDs to be UIDs
- if ($store{Name} eq RT::User::_PrefName("DashboardsInMenu")) {
+ if ( $store{Name} =~ /^(?:Pref-)?DashboardsInMenu$/ ) {
my $content = $self->_DeserializeContent($store{Content});
for my $pane (values %{ $content || {} }) {
for (@$pane) {
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 5be8caa452..24593f566f 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -1801,6 +1801,7 @@ sub InsertData {
my %order = (
'Dashboard' => 1,
'HomepageSettings' => 1,
+ 'DashboardsInMenu' => 2,
'Pref-DashboardsInMenu' => 2,
'Subscription' => 2,
);
@@ -2839,7 +2840,7 @@ sub _CanonilizeAttributeContent {
}
}
}
- elsif ( $item->{Name} eq 'Pref-DashboardsInMenu' ) {
+ elsif ( $item->{Name} =~ /^(?:Pref-)?DashboardsInMenu$/ ) {
my @dashboards;
for my $entry ( @{ $item->{Content}{dashboards} } ) {
if ( $entry->{ObjectType} && $entry->{ObjectId} && $entry->{Description} ) {
diff --git a/lib/RT/Migrate/Serializer/JSON.pm b/lib/RT/Migrate/Serializer/JSON.pm
index 6dde64ce3c..c12eac1dd3 100644
--- a/lib/RT/Migrate/Serializer/JSON.pm
+++ b/lib/RT/Migrate/Serializer/JSON.pm
@@ -524,7 +524,7 @@ sub CanonicalizeAttributes {
}
}
}
- elsif ( $record->{Name} eq 'Pref-DashboardsInMenu' ) {
+ elsif ( $record->{Name} =~ /^(?:Pref-)?DashboardsInMenu$/ ) {
my @dashboards;
for my $item ( @{ $record->{Content}{dashboards} } ) {
if ( ref $item eq 'SCALAR' && $$item =~ /(\d+)$/ ) {
--
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.
More information about the rt-commit
mailing list