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>
This commit is contained in:
parent
02b7f74016
commit
d3a10b4983
|
@ -133,6 +133,12 @@ func (dirlist *DirectoryList) Select(name string) {
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(dirlist.UiConfig().DirListDelay):
|
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},
|
dirlist.worker.PostAction(&types.OpenDirectory{Directory: name},
|
||||||
func(msg types.WorkerMessage) {
|
func(msg types.WorkerMessage) {
|
||||||
switch msg.(type) {
|
switch msg.(type) {
|
||||||
|
@ -156,6 +162,9 @@ func (dirlist *DirectoryList) Select(name string) {
|
||||||
sort.Strings(dirlist.dirs)
|
sort.Strings(dirlist.dirs)
|
||||||
}
|
}
|
||||||
dirlist.sortDirsByFoldersSortConfig()
|
dirlist.sortDirsByFoldersSortConfig()
|
||||||
|
if newStore {
|
||||||
|
dirlist.worker.PostAction(&types.FetchDirectoryContents{}, nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dirlist.Invalidate()
|
dirlist.Invalidate()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue