mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 14:26:30 +03:00
fix permanently hiding of one-to-one chats after secure-join (#2791)
* test one-to-one chats on setup-contact/secure-join only one chat is created after scanning a QR code: - on setup-contact, one-to-ones are created on both sided - on secure-join, the joined group chat is created; one-to-ones are not created intitally, but should become visible on receiving messages * make sure, Alice creates the chat with Bob on setup-contact not totally sure if that change in #2508 was on-purpose, however, all yet released versions did create the one-to-one chat also on the Inviter's (Alice) side, so, let's stay with that, i do not see many reasons to change that. * unblock hidden (Blocked::Yes) one-to-one chats one-to-one chats may be hidden by secure-join, in case someone later writes a message to it (not unlikely), the chat needs to be shown. before, messages are just not shown, the corresponding chat did not appear. the 'Blocked' wording of a 'Chat' must not be mixed with the 'Blocking' of a contact. 'Chat-Blocking' is mostly a visibility thing, that may change as messages come in. this change should not affect _really_ blocked contacts - they are filtered out already before and their messages are usually not even downloaded. also, before allow_creation is checked, that may disallow chat creation for show_emails reasons. all in all, it just does the same as if the user has manualy deleted the chat before and it would be created. * simplify test
This commit is contained in:
@@ -664,11 +664,12 @@ async fn add_parts(
|
||||
}
|
||||
|
||||
if let Some(chat_id) = chat_id {
|
||||
if Blocked::Not != chat_id_blocked {
|
||||
if Blocked::Not == create_blocked {
|
||||
chat_id.unblock(context).await?;
|
||||
chat_id_blocked = Blocked::Not;
|
||||
} else if parent.is_some() {
|
||||
if chat_id_blocked != Blocked::Not {
|
||||
if chat_id_blocked != create_blocked {
|
||||
chat_id.set_blocked(context, create_blocked).await?;
|
||||
chat_id_blocked = create_blocked;
|
||||
}
|
||||
if create_blocked == Blocked::Request && parent.is_some() {
|
||||
// we do not want any chat to be created implicitly. Because of the origin-scale-up,
|
||||
// the contact requests will pop up and this should be just fine.
|
||||
Contact::scaleup_origin_by_id(context, from_id, Origin::IncomingReplyTo)
|
||||
@@ -806,9 +807,9 @@ async fn add_parts(
|
||||
}
|
||||
|
||||
if let Some(chat_id) = chat_id {
|
||||
if Blocked::Not != chat_id_blocked && Blocked::Not == create_blocked {
|
||||
chat_id.unblock(context).await?;
|
||||
chat_id_blocked = Blocked::Not;
|
||||
if chat_id_blocked != Blocked::Not && chat_id_blocked != create_blocked {
|
||||
chat_id.set_blocked(context, create_blocked).await?;
|
||||
chat_id_blocked = create_blocked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user