aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/msgstore.go7
-rw-r--r--widgets/account.go1
-rw-r--r--worker/imap/checkmail.go1
-rw-r--r--worker/imap/list.go1
-rw-r--r--worker/maildir/worker.go12
-rw-r--r--worker/notmuch/eventhandlers.go6
-rw-r--r--worker/types/messages.go4
7 files changed, 19 insertions, 13 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 5349aa62..3125d69d 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -214,12 +214,15 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
updateThreads := false
directoryChange := false
switch msg := msg.(type) {
+ case *types.OpenDirectory:
+ store.Sort(store.sortCriteria, nil)
+ update = true
case *types.DirectoryInfo:
store.DirInfo = *msg.Info
- if !msg.SkipSort {
+ if msg.Refetch {
store.Sort(store.sortCriteria, nil)
+ update = true
}
- update = true
case *types.DirectoryContents:
newMap := make(map[uint32]*models.MessageInfo)
for _, uid := range msg.Uids {
diff --git a/widgets/account.go b/widgets/account.go
index fece0846..40ae73f3 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -263,6 +263,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
// snappier. If not, we'll unset the store and show the spinner
// while we download the UID list.
acct.msglist.SetStore(store)
+ acct.Store().Update(msg.InResponseTo())
} else {
acct.msglist.SetStore(nil)
}
diff --git a/worker/imap/checkmail.go b/worker/imap/checkmail.go
index 8f9e1b2b..c1b6ec4c 100644
--- a/worker/imap/checkmail.go
+++ b/worker/imap/checkmail.go
@@ -60,7 +60,6 @@ func (w *IMAPWorker) handleCheckMailMessage(msg *types.CheckMail) {
Unseen: int(status.Unseen),
Caps: w.caps,
},
- SkipSort: true,
}, nil)
}
if len(remaining) > 0 {
diff --git a/worker/imap/list.go b/worker/imap/list.go
index 04e6c39b..c7f1ed58 100644
--- a/worker/imap/list.go
+++ b/worker/imap/list.go
@@ -67,7 +67,6 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
Unseen: int(status.Unseen),
Caps: imapw.caps,
},
- SkipSort: true,
}, nil)
}
default:
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index a94792bc..dc794a10 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -38,6 +38,7 @@ type Worker struct {
c *Container
selected *maildir.Dir
selectedName string
+ selectedInfo *models.DirectoryInfo
worker *types.Worker
watcher types.FSWatcher
currentSortCriteria []*types.SortCriterion
@@ -112,8 +113,13 @@ func (w *Worker) handleFSEvent(ev *types.FSEvent) {
}
dirInfo := w.getDirectoryInfo(w.selectedName)
+ var refetch bool
+ if dirInfo.Exists > w.selectedInfo.Exists {
+ refetch = true
+ }
w.worker.PostMessage(&types.DirectoryInfo{
- Info: dirInfo,
+ Info: dirInfo,
+ Refetch: refetch,
}, nil)
}
@@ -394,6 +400,7 @@ func (w *Worker) handleOpenDirectory(msg *types.OpenDirectory) error {
info := &types.DirectoryInfo{
Info: w.getDirectoryInfo(msg.Directory),
}
+ w.selectedInfo = info.Info
w.worker.PostMessage(info, nil)
return nil
}
@@ -865,8 +872,7 @@ func (w *Worker) handleCheckMail(msg *types.CheckMail) {
}
dirInfo := w.getDirectoryInfo(name)
w.worker.PostMessage(&types.DirectoryInfo{
- Info: dirInfo,
- SkipSort: true,
+ Info: dirInfo,
}, nil)
}
w.done(msg)
diff --git a/worker/notmuch/eventhandlers.go b/worker/notmuch/eventhandlers.go
index 2b03d68b..996187fa 100644
--- a/worker/notmuch/eventhandlers.go
+++ b/worker/notmuch/eventhandlers.go
@@ -30,16 +30,14 @@ func (w *worker) handleUpdateDirCounts() error {
for name := range folders {
query := fmt.Sprintf("folder:%s", strconv.Quote(name))
w.w.PostMessage(&types.DirectoryInfo{
- Info: w.getDirectoryInfo(name, query),
- SkipSort: true,
+ Info: w.getDirectoryInfo(name, query),
}, nil)
}
}
for name, query := range w.nameQueryMap {
w.w.PostMessage(&types.DirectoryInfo{
- Info: w.getDirectoryInfo(name, query),
- SkipSort: true,
+ Info: w.getDirectoryInfo(name, query),
}, nil)
}
return nil
diff --git a/worker/types/messages.go b/worker/types/messages.go
index 7e3f8202..0745de5b 100644
--- a/worker/types/messages.go
+++ b/worker/types/messages.go
@@ -207,8 +207,8 @@ type Directory struct {
type DirectoryInfo struct {
Message
- Info *models.DirectoryInfo
- SkipSort bool
+ Info *models.DirectoryInfo
+ Refetch bool
}
type DirectoryContents struct {