store: fix deleting messages in filter mode

fix deleting messages when in filter mode.

Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CCIO3IVSM2JUB.3L46NM6LJZ2KB%40Archetype%3E

Reported-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Koni Marti 2022-03-19 21:51:05 +01:00 committed by Robin Jarry
parent e49f08e35f
commit 7d2b0f579d
1 changed files with 8 additions and 0 deletions

View File

@ -290,6 +290,14 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
} }
store.results = newResults store.results = newResults
var newFiltered []uint32
for _, res := range store.filtered {
if _, deleted := toDelete[res]; !deleted {
newFiltered = append(newFiltered, res)
}
}
store.filtered = newFiltered
for _, thread := range store.Threads { for _, thread := range store.Threads {
thread.Walk(func(t *types.Thread, _ int, _ error) error { thread.Walk(func(t *types.Thread, _ int, _ error) error {
if _, deleted := toDelete[t.Uid]; deleted { if _, deleted := toDelete[t.Uid]; deleted {