mirror of
https://github.com/axllent/mailpit.git
synced 2024-12-30 23:17:59 +02:00
Fix: Delete all messages matching search when more than 1000 results
This commit is contained in:
parent
898b36ce0b
commit
60a41ce3ca
@ -124,7 +124,7 @@ func DeleteSearch(search string) error {
|
||||
if len(ids) > 0 {
|
||||
total := len(ids)
|
||||
|
||||
// split ids into chunks
|
||||
// split ids into chunks of 1000 ids
|
||||
var chunks [][]string
|
||||
if total > 1000 {
|
||||
chunkSize := 1000
|
||||
@ -132,6 +132,10 @@ func DeleteSearch(search string) error {
|
||||
for chunkSize < len(ids) {
|
||||
ids, chunks = ids[chunkSize:], append(chunks, ids[0:chunkSize:chunkSize])
|
||||
}
|
||||
if len(ids) > 0 {
|
||||
// add remaining ids <= 1000
|
||||
chunks = append(chunks, ids)
|
||||
}
|
||||
} else {
|
||||
chunks = append(chunks, ids)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user