1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-05-31 23:09:51 +02:00

Fix: Message view not updating when deleting messages from search (#395)

* Fix message view not updating when deleting messages from search

* Move logic to after SQL execution and prune if > 200 messages
This commit is contained in:
avesst 2024-11-30 10:54:14 +01:00 committed by GitHub
parent aabb2acab9
commit 6e44691f6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@ import (
"github.com/araddon/dateparse"
"github.com/axllent/mailpit/internal/logger"
"github.com/axllent/mailpit/internal/tools"
"github.com/axllent/mailpit/server/websockets"
"github.com/leporo/sqlf"
)
@ -201,6 +202,18 @@ func DeleteSearch(search, timezone string) error {
dbLastAction = time.Now()
// broadcast changes
if len(ids) > 200 {
websockets.Broadcast("prune", nil)
} else {
for _, id := range ids {
d := struct {
ID string
}{ID: id}
websockets.Broadcast("delete", d)
}
}
addDeletedSize(int64(deleteSize))
logMessagesDeleted(total)