[Rt-commit] rt branch, 5.0/fix-saved-search-component, created. rt-5.0.0-2-ga3ac8770bb

Aaron Trevena ast at bestpractical.com
Thu Aug 20 11:40:01 EDT 2020


The branch, 5.0/fix-saved-search-component has been created
        at  a3ac8770bb7bb4efa76c241a3dfcda6a7641af9d (commit)

- Log -----------------------------------------------------------------
commit a3ac8770bb7bb4efa76c241a3dfcda6a7641af9d
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Thu Aug 6 08:34:04 2020 +0100

    Add ColumnMapClassName method to RT::SharedSetting
    
    Addresses a bug causing a fatal error in the SavedSearch dashboard component:
    Can't locate object method "ColumnMapClassName" via package "RT::SavedSearch"
    
    Commit f6cdaf8c11f252fd3e31ee85c8f8db7ad4fbbfe8 added support for multiple
    types of RT::Record to the querybuilder in addition to tickets, using the
    ColumnMapClassName method to provide the classname for ColumnMap to load the
    correct list display. SharedSetting sub-classes aren't simple records and so
    didn't have this method resulting in an error when used in dashboard
    component searches.
    
    Adding the ColumnMapClassName method to the RT::SharedSetting base class
    allows objects inheriting from it to work in the same way as RT::Record based
    objects, and makes any method providing a hardcoded classname un-necessary.
    
    Fixes: I#36605

diff --git a/lib/RT/Dashboards.pm b/lib/RT/Dashboards.pm
index 23f2fc5aa3..2fd8628889 100644
--- a/lib/RT/Dashboards.pm
+++ b/lib/RT/Dashboards.pm
@@ -120,10 +120,6 @@ sub SortDashboards {
     return;
 }
 
-sub ColumnMapClassName {
-    return 'RT__Dashboard';
-}
-
 RT::Base->_ImportOverlays();
 
 1;
diff --git a/lib/RT/SharedSetting.pm b/lib/RT/SharedSetting.pm
index f66912876b..407957e9bd 100644
--- a/lib/RT/SharedSetting.pm
+++ b/lib/RT/SharedSetting.pm
@@ -385,6 +385,18 @@ sub CurrentUserCanCreate { 1 }
 sub CurrentUserCanModify { 1 }
 sub CurrentUserCanDelete { 1 }
 
+=head2 ColumnMapClassName
+
+ColumnMap needs a massaged collection class name to load the correct list
+display.  Equivalent to L<RT::SearchBuilder/ColumnMapClassName>, but provided
+for a record instead of a collection.
+
+Returns a string.  May be called as a package method.
+
+=cut
+
+sub ColumnMapClassName { return RT::Record::ColumnMapClassName(shift) }
+
 ### Internal methods
 
 # _GetObject: helper routine to load the correct object whose parameters
diff --git a/lib/RT/SharedSettings.pm b/lib/RT/SharedSettings.pm
index 79e42bd70d..266fe235ea 100644
--- a/lib/RT/SharedSettings.pm
+++ b/lib/RT/SharedSettings.pm
@@ -138,6 +138,21 @@ sub GotoPage {
     $self->{idx} = shift;
 }
 
+
+
+=head2 ColumnMapClassName
+
+ColumnMap needs a massaged collection class name to load the correct list
+display.  Equivalent to L<RT::SearchBuilder/ColumnMapClassName>, but provided
+for a record instead of a collection.
+
+Returns a string.  May be called as a package method.
+
+=cut
+
+sub ColumnMapClassName { return shift->RecordClass->ColumnMapClassName }
+
+
 ### Internal methods
 
 # _GetObject: helper routine to load the correct object whose parameters

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


More information about the rt-commit mailing list