mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 09:56:35 +03:00
imap: do not delete duplicates
Currently if user moves the message into some other folder and then moves the message back, the message is considered duplicate even though previous copy was already deleted. This is a common problem reported by users at least twice. Keeping duplicates does no harm except for additional storage usage. If the message is later deleted by the user, all the copies on the server will be deleted. anyway.
This commit is contained in:
21
src/imap.rs
21
src/imap.rs
@@ -713,19 +713,6 @@ impl Imap {
|
||||
None => folder.to_string(),
|
||||
};
|
||||
|
||||
let duplicate = context
|
||||
.sql
|
||||
.count(
|
||||
"SELECT COUNT(*)
|
||||
FROM imap
|
||||
WHERE rfc724_mid=?
|
||||
AND folder=?
|
||||
AND uid<?",
|
||||
paramsv![message_id, &target, uid],
|
||||
)
|
||||
.await?
|
||||
> 0;
|
||||
|
||||
context
|
||||
.sql
|
||||
.execute(
|
||||
@@ -734,13 +721,7 @@ impl Imap {
|
||||
ON CONFLICT(folder, uid, uidvalidity)
|
||||
DO UPDATE SET rfc724_mid=excluded.rfc724_mid,
|
||||
target=excluded.target",
|
||||
paramsv![
|
||||
message_id,
|
||||
folder,
|
||||
uid,
|
||||
uid_validity,
|
||||
if duplicate { "" } else { &target }
|
||||
],
|
||||
paramsv![message_id, folder, uid, uid_validity, &target],
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user