aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAivars Vaivods <aivars@vaivods.lv>2022-04-13 23:04:59 +0300
committerRobin Jarry <robin@jarry.cc>2022-04-14 23:48:21 +0200
commitd3a10b49834a9cb24411f8af3e68a4f8ea186152 (patch)
treefb9c51067353ba8765a5b6280065f03ea61af03b
parent02b7f7401682ffcfb2ebf1c4a2900b8f40908db4 (diff)
downloadaerc-d3a10b49834a9cb24411f8af3e68a4f8ea186152.tar.gz
Initialization fix for dynamic folders
There is an issue with backends, that provide dynamic folders, namely when opening folder, that isn't defined in config file, you get empty folder. To actually get messages listed, you need to open that folder twice. At first attempt only DirectoryInfo is fetched and new MessageStore created. Second attempt populates previously created MessageStore with list of messages. For pre-configured folders, DirectoryInfos are fetched upon connection to backend and, when folder is opened, MessageStore is updated with list of messages. Fixes: https://todo.sr.ht/~rjarry/aerc/30 Signed-off-by: Aivars Vaivods <aivars@vaivods.lv> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--widgets/dirlist.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 11e1b208..b6c09dda 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -133,6 +133,12 @@ func (dirlist *DirectoryList) Select(name string) {
select {
case <-time.After(dirlist.UiConfig().DirListDelay):
+ newStore := true
+ for _, s := range dirlist.store.List() {
+ if s == dirlist.selecting {
+ newStore = false
+ }
+ }
dirlist.worker.PostAction(&types.OpenDirectory{Directory: name},
func(msg types.WorkerMessage) {
switch msg.(type) {
@@ -156,6 +162,9 @@ func (dirlist *DirectoryList) Select(name string) {
sort.Strings(dirlist.dirs)
}
dirlist.sortDirsByFoldersSortConfig()
+ if newStore {
+ dirlist.worker.PostAction(&types.FetchDirectoryContents{}, nil)
+ }
}
dirlist.Invalidate()
})