Revert "Only fetch the directory contents when we are switching directories"
This reverts commit bd4df53009
.
I did not properly untangle the opening / dirlist update of each other.
This interferes with the imap worker, hence the revert
This commit is contained in:
parent
bcab8de072
commit
d44bdc9fb9
|
@ -31,6 +31,8 @@ type MessageStore struct {
|
|||
resultIndex int
|
||||
filter bool
|
||||
|
||||
defaultSortCriteria []*types.SortCriterion
|
||||
|
||||
// Map of uids we've asked the worker to fetch
|
||||
onUpdate func(store *MessageStore) // TODO: multiple onUpdate handlers
|
||||
onUpdateDirs func()
|
||||
|
@ -44,6 +46,7 @@ type MessageStore struct {
|
|||
|
||||
func NewMessageStore(worker *types.Worker,
|
||||
dirInfo *models.DirectoryInfo,
|
||||
defaultSortCriteria []*types.SortCriterion,
|
||||
triggerNewEmail func(*models.MessageInfo),
|
||||
triggerDirectoryChange func()) *MessageStore {
|
||||
|
||||
|
@ -57,6 +60,8 @@ func NewMessageStore(worker *types.Worker,
|
|||
bodyCallbacks: make(map[uint32][]func(io.Reader)),
|
||||
headerCallbacks: make(map[uint32][]func(*types.MessageInfo)),
|
||||
|
||||
defaultSortCriteria: defaultSortCriteria,
|
||||
|
||||
pendingBodies: make(map[uint32]interface{}),
|
||||
pendingHeaders: make(map[uint32]interface{}),
|
||||
worker: worker,
|
||||
|
@ -172,6 +177,9 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
|
|||
switch msg := msg.(type) {
|
||||
case *types.DirectoryInfo:
|
||||
store.DirInfo = *msg.Info
|
||||
store.worker.PostAction(&types.FetchDirectoryContents{
|
||||
SortCriteria: store.defaultSortCriteria,
|
||||
}, nil)
|
||||
update = true
|
||||
case *types.DirectoryContents:
|
||||
newMap := make(map[uint32]*models.MessageInfo)
|
||||
|
|
|
@ -242,6 +242,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
|
|||
store.Update(msg)
|
||||
} else {
|
||||
store = lib.NewMessageStore(acct.worker, msg.Info,
|
||||
acct.getSortCriteria(),
|
||||
func(msg *models.MessageInfo) {
|
||||
acct.conf.Triggers.ExecNewEmail(acct.acct,
|
||||
acct.conf, msg)
|
||||
|
@ -256,7 +257,6 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
|
|||
acct.msglist.SetStore(store)
|
||||
})
|
||||
}
|
||||
acct.dirlist.Invalidate()
|
||||
case *types.DirectoryContents:
|
||||
if store, ok := acct.dirlist.SelectedMsgStore(); ok {
|
||||
store.Update(msg)
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
"git.sr.ht/~sircmpwn/aerc/config"
|
||||
"git.sr.ht/~sircmpwn/aerc/lib"
|
||||
libsort "git.sr.ht/~sircmpwn/aerc/lib/sort"
|
||||
"git.sr.ht/~sircmpwn/aerc/lib/ui"
|
||||
"git.sr.ht/~sircmpwn/aerc/models"
|
||||
"git.sr.ht/~sircmpwn/aerc/worker/types"
|
||||
|
@ -105,10 +104,6 @@ func (dirlist *DirectoryList) Select(name string) {
|
|||
}
|
||||
sort.Strings(dirlist.dirs)
|
||||
dirlist.sortDirsByFoldersSortConfig()
|
||||
// once opened, we need to enumerate the contents
|
||||
dirlist.worker.PostAction(&types.FetchDirectoryContents{
|
||||
SortCriteria: dirlist.getSortCriteria(),
|
||||
}, nil)
|
||||
}
|
||||
dirlist.Invalidate()
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue