Skip to content

Comments

fix: Sync chat action even if sync message arrives before first one from contact (#6259)#6277

Merged
iequidoo merged 1 commit intomainfrom
iequidoo/sync_alter_chat-add-contact
Dec 1, 2024
Merged

fix: Sync chat action even if sync message arrives before first one from contact (#6259)#6277
iequidoo merged 1 commit intomainfrom
iequidoo/sync_alter_chat-add-contact

Conversation

@iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Nov 29, 2024

Fix #6259

@iequidoo iequidoo marked this pull request as ready for review November 29, 2024 23:59
@iequidoo iequidoo requested a review from link2xt November 29, 2024 23:59
ChatIdBlocked::lookup_by_contact(self, contact_id)
// Use `Request` so that even if the program crashes, the user doesn't have to look
// into the blocked contacts.
ChatIdBlocked::get_for_contact(self, contact_id, Blocked::Request)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe create the chat with Blocked::Not or Blocked::Yes already based on SyncAction? And if it is not Block or Unblock, then Blocked::Request.

Copy link
Collaborator Author

@iequidoo iequidoo Nov 30, 2024

Choose a reason for hiding this comment

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

For a 1:1 chat possible actions are Block, Accept, SetVisibility, SetMuted, Rename and even Unblock if Block was missed somehow before e.g. the synchronization was disabled. I don't think it's worth complicating the logic adding one more match here. Blocked::Request reflects what happens on the first device (first the chat is created and only then the user does smth), i think this is fine even if we crash/fail and don't finish the job.

@iequidoo iequidoo requested a review from link2xt November 30, 2024 16:22
…rom contact (#6259)

A sync message for accepting or blocking a 1:1 chat may arrive before the first message from the
contact, when it does not exist yet. This frequently happens in non-chatmail accounts that have
moving to the DeltaChat folder disabled because Delta Chat unconditionally uploads sync messages to
the DeltaChat folder. Let's create a hidden contact in this case and a 1:1 chat for it.
@iequidoo iequidoo force-pushed the iequidoo/sync_alter_chat-add-contact branch from b2f5c55 to b5b8f5d Compare November 30, 2024 16:27
@iequidoo iequidoo merged commit cbe5c38 into main Dec 1, 2024
@iequidoo iequidoo deleted the iequidoo/sync_alter_chat-add-contact branch December 1, 2024 16:49
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.

Synchronize accepting not yet existing contacts

2 participants