Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deletion of messages quickly deleted after sending (#3685) #5382

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Mar 27, 2024

See commit messages.

Fix #3685
Fix #5379

@iequidoo
Copy link
Collaborator Author

iequidoo commented Mar 27, 2024

Another problem is that a quickly deleted message still remains on the server. Should be fixed too.
EDIT: Done.

@iequidoo iequidoo marked this pull request as ready for review March 27, 2024 06:41


def test_deleted_msgs_dont_reappear(acfactory):
(ac1,) = acfactory.get_online_accounts(1)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bcc_self doesn't need to be set, we anyway send the message to self. But it's an interesting question: why we do so? Maybe if we send a message to self and bcc_self is disabled, just store it locally?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the test at least I'd set bcc_self explicitly.

Copy link
Collaborator Author

@iequidoo iequidoo Mar 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Anyway, why do we smtp-send self-messages at all if bcc_self is unset? This looks like an exception from what we have for chats in general (1:1, group, etc.)

@iequidoo iequidoo requested review from link2xt and r10s March 27, 2024 19:52
@iequidoo iequidoo changed the title fix: Keep tombstones for two days before deleting (#3685) Fix deletion of messages quickly deleted after sending (#3685) Mar 28, 2024


def test_deleted_msgs_dont_reappear(acfactory):
(ac1,) = acfactory.get_online_accounts(1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the test at least I'd set bcc_self explicitly.

src/message.rs Outdated Show resolved Hide resolved
src/download.rs Outdated Show resolved Hide resolved
src/download.rs Outdated Show resolved Hide resolved
src/message.rs Outdated Show resolved Hide resolved
@@ -910,6 +910,13 @@ CREATE INDEX msgs_status_updates_index2 ON msgs_status_updates (uid);
)
.await?;
}
if dbversion < 111 {
sql.execute_migration(
"ALTER TABLE msgs ADD COLUMN deleted INTEGER NOT NULL DEFAULT 0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If message is a partial download, it gets trashed with deleted=0 and then MIN(deleted) over such message is always false even if user explicitly deletes message? This deleted column is only used in a fix for outgoing deleted messages so far, but it seems to be wrong for incoming messages and outgoing large messages if they are received from other device. The fix for this particular case is working, but it seems to be very difficult to describe what is stored in the deleted column. Could you add a comment for the column describing what exactly does it store?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this, see receive_imf::add_parts(). But there's still a problem: if the server modifies Message-ID, the fix doesn't work. But it's a corner case and maybe it's not worth fixing. Added a comment here also.

@iequidoo iequidoo requested a review from link2xt April 8, 2024 05:56
@iequidoo iequidoo force-pushed the iequidoo/keep-tombstones branch 2 times, most recently from 20ed740 to 8257c10 Compare April 15, 2024 04:05
@iequidoo iequidoo marked this pull request as draft April 15, 2024 06:02
@iequidoo iequidoo force-pushed the iequidoo/keep-tombstones branch 2 times, most recently from c2ace28 to 172d27e Compare April 15, 2024 09:06
@iequidoo
Copy link
Collaborator Author

It's funny that a new test_deleted_msgs_dont_reappear() caught a bunch of problems with loading trashed messages

This is a way to prevent redownloading locally deleted messages. Otherwise if a message is deleted
quickly after sending and `bcc_self` is configured, the BCC copy is downloaded and appears as a new
message as it happens for messages sent from another device.
…on IMAP later

Before, if the user deleted a message too quickly after sending, it was deleted only locally. The
fix is to remember for tombstones that the corresponding message should be deleted on the server
too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

contact verification process triggered twice per each single QR scan Deleted messages reappear
2 participants