From 6db766260b7c23ec113e31010e0ac68105622956 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 26 Jul 2022 08:13:21 -0500 Subject: sort: clear sort criteria when called without arguments Fix a regression introduced by commit c2f4404fca15 ("threading: enable filtering of server-side threads"). Prior to this commit, a :sort command (no args) would clear out the current sort criteria (or rather, apply the value from the config). Restore this functionality. Fixes: c2f4404fca15 ("threading: enable filtering of server-side threads") Reported-by: akspecs Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- lib/msgstore.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/msgstore.go b/lib/msgstore.go index c9f8fd9..d9140d7 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -801,11 +801,7 @@ func (store *MessageStore) ModifyLabels(uids []uint32, add, remove []string, } func (store *MessageStore) Sort(criteria []*types.SortCriterion, cb func(types.WorkerMessage)) { - if criteria == nil { - criteria = store.sortCriteria - } else { - store.sortCriteria = criteria - } + store.sortCriteria = criteria store.Sorting = true handle_return := func(msg types.WorkerMessage) { @@ -828,6 +824,10 @@ func (store *MessageStore) Sort(criteria []*types.SortCriterion, cb func(types.W } } +func (store *MessageStore) GetCurrentSortCriteria() []*types.SortCriterion { + return store.sortCriteria +} + // returns the index of needle in haystack or -1 if not found func (store *MessageStore) visualStartIdx() int { for idx, u := range store.Uids() { -- cgit v1.2.3