Skip to content

Conversation

iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Jul 29, 2024

See commit messages.

My devices go online/offline independently and i use both to send messages, so often i see my messages wrongly ordered around incoming messages.

@iequidoo
Copy link
Collaborator Author

iequidoo commented Oct 12, 2024

The test i added here isn't needed, there's test_old_message_5() already which does the same, but instead records the current (wrong) behaviour. Going to fix it then. EDIT: Done

@iequidoo iequidoo force-pushed the iequidoo/test_sync_sentbox_then_inbox branch from 4ea6d9d to ce4be1d Compare October 12, 2024 01:07
@iequidoo iequidoo changed the title test: Order of messages if Sentbox is synced before Inbox fix: Order of messages if Sentbox is synced before Inbox Oct 12, 2024
@iequidoo iequidoo changed the base branch from main to iequidoo/sort-rcvd-outgoing-msgs-down October 12, 2024 01:09
@iequidoo iequidoo marked this pull request as ready for review October 12, 2024 01:23
@iequidoo iequidoo requested a review from link2xt October 12, 2024 01:24
@iequidoo iequidoo force-pushed the iequidoo/sort-rcvd-outgoing-msgs-down branch 4 times, most recently from 3214eb6 to 6c01309 Compare October 14, 2024 23:49
Base automatically changed from iequidoo/sort-rcvd-outgoing-msgs-down to main October 15, 2024 00:22
@iequidoo iequidoo force-pushed the iequidoo/test_sync_sentbox_then_inbox branch from ce4be1d to da4a84e Compare October 15, 2024 00:27
@iequidoo
Copy link
Collaborator Author

Btw, i think it may be useful to display these outgoing received messages (i.e. from other MUAs/devices) somehow differently e.g. align them to the left as incoming ones. As they still have another brightness (even in Dark mode), it shouldn't be a problem to differ them from incoming messages. May be even useful for shared/community accounts, not sure. CC @adbenitez

@iequidoo
Copy link
Collaborator Author

iequidoo commented Oct 25, 2024

Recently i started to see my messages weirdly ordered around incoming ones every day when i open my laptop lid (i.e. i see my replies above incoming messages). I don't know whether Delta Chat started scheduling smth differently or i changed its usage pattern, but this PR should help it seems.

@iequidoo iequidoo requested a review from Hocuri October 25, 2024 22:41
Copy link
Collaborator

@Hocuri Hocuri left a comment

Choose a reason for hiding this comment

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

The PR description is quite short, the PR is easier to understand if the PR description has a short explanation in which way the logic was changed.

Btw, i think it may be useful to display these outgoing received messages (i.e. from other MUAs/devices) somehow differently e.g. align them to the left as incoming ones. As they still have another brightness (even in Dark mode), it shouldn't be a problem to differ them from incoming messages.

I'm pretty sure that non-technical users would find this super confusing.

Msg#11: Me (Contact#Contact#Self): I'm Alice too
Msg#11: Me (Contact#Contact#Self): I'm Alice too
Copy link
Collaborator

Choose a reason for hiding this comment

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

So, this means that this is a breaking change (i.e. will need UI adaptions)? If so, this PR should start with fix! instead of fix, and the PR description should mention this.

And, it means that outgoing messages that were sent by a different device won't have any checkmarks anymore? I personally don't think that's a good idea because that's not how users know it from other messengers, but if others think otherwise, I'd be happy to be outvoted / convinced otherwise.

Copy link
Collaborator Author

@iequidoo iequidoo Oct 28, 2024

Choose a reason for hiding this comment

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

No, it shouldn't be a breaking change, i forgot to map OutRcvd to OutDelivered in all APIs. Fixed this.

EDIT: Only for REPL the display of received outgoing messages changes.

@iequidoo iequidoo force-pushed the iequidoo/test_sync_sentbox_then_inbox branch from da4a84e to c564e75 Compare October 28, 2024 17:10
@iequidoo iequidoo marked this pull request as draft October 28, 2024 17:13
@iequidoo iequidoo force-pushed the iequidoo/test_sync_sentbox_then_inbox branch 2 times, most recently from 91eaf72 to 8bbee4a Compare October 28, 2024 17:23
@iequidoo
Copy link
Collaborator Author

The PR description is quite short, the PR is easier to understand if the PR description has a short explanation in which way the logic was changed.

I put everything to commit messages to avoid updating the PR description every time they change. Probably it's better to leave the PR description empty then or just reference the commit messages.

Btw, i think it may be useful to display these outgoing received messages (i.e. from other MUAs/devices) somehow differently e.g. align them to the left as incoming ones. As they still have another brightness (even in Dark mode), it shouldn't be a problem to differ them from incoming messages.

I'm pretty sure that non-technical users would find this super confusing.

Probably yes, though for shared/community accounts this may be useful, but then also we need to check for presence of override_sender_name to avoid confusion for other users. Anyway currently in the message Info the user can check if it's a sent or received outgoing message, so my proposal doesn't add smth new, this is only a question of usability.

@iequidoo iequidoo marked this pull request as ready for review October 28, 2024 17:44
@iequidoo iequidoo requested a review from Hocuri October 28, 2024 17:45
@iequidoo iequidoo force-pushed the iequidoo/test_sync_sentbox_then_inbox branch from 8bbee4a to 3470b26 Compare October 29, 2024 22:23
@iequidoo iequidoo force-pushed the iequidoo/test_sync_sentbox_then_inbox branch from 3470b26 to f3ff8e3 Compare December 16, 2024 17:22
@iequidoo iequidoo force-pushed the iequidoo/test_sync_sentbox_then_inbox branch from f3ff8e3 to ae0d404 Compare July 4, 2025 21:54
This fixes a Gmail-like scenario when outgoing messages are saved to Sentbox as well and it is
fetched before Inbox by chance, by adding a new `OutRcvd` message state for received outgoing
messages so that they can mingle with fresh incoming ones. As for `OutPending`, `OutDelivered`
etc. messages, they are sent locally by the user and there's no need to make them more noticeable
even if they are newer.

All APIs still return `OutDelivered` instead of `OutRcvd` for compatibility.
@iequidoo iequidoo force-pushed the iequidoo/test_sync_sentbox_then_inbox branch from ae0d404 to 3a4af2b Compare September 2, 2025 11:21
@r10s
Copy link
Contributor

r10s commented Sep 2, 2025

closing stale pr, to avoid more resources put in here

from the issue description, it is eg. about since years discouraged "shared account usage" with eg. gmail, which we do not want to care for, let alone introduce a state that is otherwise not needed.

also, we do not want to continue "upload messages via imap" this is about to be removed at some point. same for "watch sent folder" and maybe other dependencies on imap standing in the way of thinking about new ways of transport and resilience (as they cost resources, time and money we do not have)

@r10s r10s closed this Sep 2, 2025
@iequidoo
Copy link
Collaborator Author

iequidoo commented Sep 3, 2025

The issue is about Delta Chat -only usage with Gmail, but with "Watch Sent folder" enabled (i quite rarely use other clients, so it's mostly enabled just in case). I.e. while the option is enabled for "shared usage", it makes harm for Delta Chat -only usage, sometimes i just can't understand my previous conversations when i open my laptop lid because all messages are ordered almost randomly. "Save messages to savebox" ("Sent" folder actually) is Gmail's behavior, we can't do anything with it. Gmail's "Sent" folder is actually a label and all messages you send are duplicated there (they even have the same Message-ID).

I'll try to reproduce it w/o "Watch Sent folder" (already tried to disable it, but forgot whether that helped). It's probably difficult to catch the bug w/o "Watch Sent folder":

  • Device A must go sleep immediately after you sent a reply, so the incoming message is moved to "Delta Chat", but not the reply.
  • Device B should fetch "Inbox" first and "Delta Chat" after that, so the reply will be "higher" in the chat.

But apart from this the PR fixes ordering messages for "shared account usage" because in this case received outgoing messages (which may be sent by another user/device) should be sorted the same way as incoming ones and defenitely not break sorting of them. Currently, if we receive an outgoing message, it works as a barrier for incoming messages (even if the chat isn't open at the moment), so they can't be ordered purely by their "Date".

@r10s
Copy link
Contributor

r10s commented Sep 3, 2025

It's probably difficult to catch the bug w/o "Watch Sent folder"

thanks for confirming.

i clarified the post above bit.

@link2xt
Copy link
Collaborator

link2xt commented Sep 3, 2025

Related issue seemingly describing the same problem: deltachat/deltachat-android#3900

@r10s
Copy link
Contributor

r10s commented Sep 3, 2025

"Watch Sent folder" was always a questionable option of questionable worth. we were thinking about removing "Watch Sent folder" already years ago, and left it, as it "did not hurt". but that has changed now, we should remove the option alltogether now

that will remove one footgun of ppl going for shared account usage, while at the same time removing complexity and effort for us

@iequidoo
Copy link
Collaborator Author

iequidoo commented Sep 3, 2025

It's probably difficult to catch the bug w/o "Watch Sent folder":

  • Device A must go sleep immediately after you sent a reply, so the incoming message is moved to "Delta Chat", but not the reply.

  • Device B should fetch "Inbox" first and "Delta Chat" after that, so the reply will be "higher" in the chat.

It's impossible to reproduce the bug just this way because imap::fetch_new_messages() only fetches messages that have reached their destination folder, i.e. "Delta Chat", so device B must also have MvboxMove disabled. I reproduced it this way. Having MvboxMove set differently on devices is a questionable configuration though, but it's possible.

So the summary is:

  • We need to remove SentboxWatch, it's definitely harmful for Gmail (even in Delta Chat -only scenario) and as for other providers, it's better to tell users that they should use To/CC/BCC to themselves to see sent messages in Delta Chat.
  • Removing MvboxMove would be also good, this way we also save more battery.
  • We should discourage users from sharing the same account accross many people (another kind of "shared account usage") because in this case an outgoing message sent by another person from another device must be sorted like an incoming one, but this can't be done using the current set of message states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed PRs & Issues
Development

Successfully merging this pull request may close these issues.

4 participants