[Rt-commit] rt branch, 4.2/migrator-fixes, updated. rt-4.2.12-116-g1b02c84

Shawn Moore shawn at bestpractical.com
Mon Mar 21 15:55:19 EDT 2016


The branch, 4.2/migrator-fixes has been updated
       via  1b02c842a7ce85deace3a24998426a4a9c47c348 (commit)
      from  84b02228763304a20edec35cc8547aa9e9c99862 (commit)

Summary of changes:
 lib/RT/Attribute.pm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

- Log -----------------------------------------------------------------
commit 1b02c842a7ce85deace3a24998426a4a9c47c348
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Mar 21 19:37:23 2016 +0000

    Serialize dashboards in menu preference using indirection
    
        Otherwise the old dashboard IDs will be kept in the user's
        preferences, causing the menu to (in most cases) be empty.
    
    Fixes: I#31810

diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index 9943b57..1152566 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -642,9 +642,40 @@ sub PreInflate {
         my $on_uid = ${ $data->{Object} };
         return if $importer->ShouldSkipTransaction($on_uid);
     }
+
+    # decode UIDs to be raw dashboard IDs
+    if ($data->{Name} eq RT::User::_PrefName("DashboardsInMenu")) {
+        my $content = $class->_DeserializeContent($data->{Content});
+        for my $pane (values %{ $content || {} }) {
+            @$pane = map { $importer->LookupObj($$_)->Id } @$pane;
+        }
+        $data->{Content} = $class->_SerializeContent($content);
+    }
+
     return $class->SUPER::PreInflate( $importer, $uid, $data );
 }
 
+sub Serialize {
+    my $self = shift;
+    my %args = (@_);
+    my %store = $self->SUPER::Serialize(@_);
+
+    # encode raw dashboard IDs to be UIDs
+    if ($store{Name} eq RT::User::_PrefName("DashboardsInMenu")) {
+        my $content = $self->_DeserializeContent($store{Content});
+        for my $pane (values %{ $content || {} }) {
+            @$pane = map {
+                my $attr = RT::Attribute->new($self->CurrentUser);
+                $attr->LoadById($_);
+                \($attr->UID)
+            } @$pane;
+        }
+        $store{Content} = $self->_SerializeContent($content);
+    }
+
+    return %store;
+}
+
 RT::Base->_ImportOverlays();
 
 1;

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


More information about the rt-commit mailing list