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:
parent
aabb2acab9
commit
6e44691f6d
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user