[Rt-commit] rt branch 5.0/sort-saved-searches created. rt-5.0.3-77-g1c7176a8f4

BPS Git Server git at git.bestpractical.com
Wed Aug 10 14:46:22 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/sort-saved-searches has been created
        at  1c7176a8f41f6a908071d42ca9990fcb7a755e2c (commit)

- Log -----------------------------------------------------------------
commit 1c7176a8f41f6a908071d42ca9990fcb7a755e2c
Author: Brian Conry <bconry at bestpractical.com>
Date:   Wed Aug 10 08:42:05 2022 -0500

    Sort SavedSearches
    
    SavedSearches were previously returned in an unpredictable order
    paralleling the order that the database returned the underlying
    Attributes, probably based more on the order in which they were created
    than on anything else.
    
    This change automatically sorts the SavedSearches by Name (stored in the
    Attribute's Description) after they are fetched in LimitToPrivacy.

diff --git a/lib/RT/SavedSearches.pm b/lib/RT/SavedSearches.pm
index f3401da74c..21725ca598 100644
--- a/lib/RT/SavedSearches.pm
+++ b/lib/RT/SavedSearches.pm
@@ -104,6 +104,7 @@ sub LimitToPrivacy {
             next if $type && $search->Type && $search->Type ne $type;
             push(@{$self->{'objects'}}, $search);
         }
+        @{$self->{'objects'}} = sort { lcfirst($a->Name) cmp lcfirst($b->Name) } @{$self->{'objects'}};
     } else {
         $RT::Logger->error("Could not load object $privacy");
     }

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list