aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-08-03 23:39:00 +0200
committerRobin Jarry <robin@jarry.cc>2023-08-04 23:41:50 +0200
commit2330d5e493443fa35544ad078a7c4228b9d33541 (patch)
tree63de4d874a46cf0e03714236a9c3dcc7ef6f4a4c /widgets
parent046b6e34ee6b53e274f03b59c895df40494eb923 (diff)
downloadaerc-2330d5e493443fa35544ad078a7c4228b9d33541.tar.gz
account: fix contextual sort
Fix contextual sort. Pass a folder-specific sort criteria to the message store when it is created. Before, the message store would receive the sort criteria from the UI config of the currently selected directory (if any was selected at all). Fixes: https://todo.sr.ht/~rjarry/aerc/121 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/widgets/account.go b/widgets/account.go
index ecf357e9..d4a74ce8 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -232,7 +232,7 @@ func (acct *AccountView) isSelected() bool {
func (acct *AccountView) newStore(name string) *lib.MessageStore {
uiConf := acct.dirlist.UiConfig(name)
store := lib.NewMessageStore(acct.worker,
- acct.GetSortCriteria(),
+ acct.sortCriteria(uiConf),
uiConf.ThreadingEnabled,
uiConf.ForceClientThreads,
uiConf.ClientThreadsDelay,
@@ -422,11 +422,14 @@ func (acct *AccountView) updateDirCounts(destination string, uids []uint32) {
}
}
-func (acct *AccountView) GetSortCriteria() []*types.SortCriterion {
- if len(acct.UiConfig().Sort) == 0 {
+func (acct *AccountView) sortCriteria(uiConf *config.UIConfig) []*types.SortCriterion {
+ if uiConf == nil {
+ return nil
+ }
+ if len(uiConf.Sort) == 0 {
return nil
}
- criteria, err := sort.GetSortCriteria(acct.UiConfig().Sort)
+ criteria, err := sort.GetSortCriteria(uiConf.Sort)
if err != nil {
acct.PushError(fmt.Errorf("ui sort: %w", err))
return nil
@@ -434,6 +437,10 @@ func (acct *AccountView) GetSortCriteria() []*types.SortCriterion {
return criteria
}
+func (acct *AccountView) GetSortCriteria() []*types.SortCriterion {
+ return acct.sortCriteria(acct.UiConfig())
+}
+
func (acct *AccountView) CheckMail() {
acct.Lock()
defer acct.Unlock()