about summary refs log tree commit diff stats
path: root/commands/account
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2019-07-31 09:50:08 +0200
committerDrew DeVault <sir@cmpwn.com>2019-08-02 09:26:10 -0400
commit3424c36d5225f6b798616dc691ea10bb693a2dcc (patch)
tree4d1eb9d7f374bea88c86ed30909484216d699d7e /commands/account
parent9570f4b4d0cdf525ce1695971636a0b58f1a091b (diff)
downloadaerc-3424c36d5225f6b798616dc691ea10bb693a2dcc.tar.gz
ChangeFolder: do not depend on the msgstore
We need to clear the filtering etc upon folder switch.
Not having a valid msgstore is however no reason not to switch directories.
Diffstat (limited to 'commands/account')
-rw-r--r--commands/account/cf.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/commands/account/cf.go b/commands/account/cf.go
index 2ebc294..f078984 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -34,22 +34,22 @@ func (_ ChangeFolder) Execute(aerc *widgets.Aerc, args []string) error {
 	if acct == nil {
 		return errors.New("No account selected")
 	}
-	store := acct.Store()
-	if store == nil {
-		return errors.New("Cannot perform action. Messages still loading")
-	}
 	previous := acct.Directories().Selected()
 	if args[1] == "-" {
 		if dir, ok := history[acct.Name()]; ok {
-			store.ApplyClear()
 			acct.Directories().Select(dir)
 		} else {
 			return errors.New("No previous folder to return to")
 		}
 	} else {
-		store.ApplyClear()
 		acct.Directories().Select(args[1])
 	}
 	history[acct.Name()] = previous
+
+	// reset store filtering if we switched folders
+	store := acct.Store()
+	if store != nil {
+		store.ApplyClear()
+	}
 	return nil
 }