mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
fix: Correct ordering of securejoin messages
This commit is contained in:
@@ -123,20 +123,23 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let timestamp = smeared_time(context);
|
||||||
match invite {
|
match invite {
|
||||||
QrInvite::Group { .. } => {
|
QrInvite::Group { .. } => {
|
||||||
let joining_chat_id = joining_chat_id(context, &invite, private_chat_id).await?;
|
let joining_chat_id =
|
||||||
|
joining_chat_id(context, &invite, private_chat_id, timestamp).await?;
|
||||||
let msg = stock_str::secure_join_started(context, invite.contact_id()).await;
|
let msg = stock_str::secure_join_started(context, invite.contact_id()).await;
|
||||||
chat::add_info_msg(context, joining_chat_id, &msg, time()).await?;
|
chat::add_info_msg(context, joining_chat_id, &msg, timestamp).await?;
|
||||||
Ok(joining_chat_id)
|
Ok(joining_chat_id)
|
||||||
}
|
}
|
||||||
QrInvite::Broadcast { .. } => {
|
QrInvite::Broadcast { .. } => {
|
||||||
let joining_chat_id = joining_chat_id(context, &invite, private_chat_id).await?;
|
let joining_chat_id =
|
||||||
|
joining_chat_id(context, &invite, private_chat_id, timestamp).await?;
|
||||||
// We created the broadcast channel already, now we need to add Alice to it.
|
// We created the broadcast channel already, now we need to add Alice to it.
|
||||||
if !is_contact_in_chat(context, joining_chat_id, invite.contact_id()).await? {
|
if !is_contact_in_chat(context, joining_chat_id, invite.contact_id()).await? {
|
||||||
chat::add_to_chat_contacts_table(
|
chat::add_to_chat_contacts_table(
|
||||||
context,
|
context,
|
||||||
time(),
|
timestamp,
|
||||||
joining_chat_id,
|
joining_chat_id,
|
||||||
&[invite.contact_id()],
|
&[invite.contact_id()],
|
||||||
)
|
)
|
||||||
@@ -148,7 +151,7 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
|
|||||||
// use the generic `Establishing guaranteed end-to-end encryption, please wait…`
|
// use the generic `Establishing guaranteed end-to-end encryption, please wait…`
|
||||||
if !is_contact_in_chat(context, joining_chat_id, ContactId::SELF).await? {
|
if !is_contact_in_chat(context, joining_chat_id, ContactId::SELF).await? {
|
||||||
let msg = stock_str::securejoin_wait(context).await;
|
let msg = stock_str::securejoin_wait(context).await;
|
||||||
chat::add_info_msg(context, joining_chat_id, &msg, time()).await?;
|
chat::add_info_msg(context, joining_chat_id, &msg, timestamp).await?;
|
||||||
}
|
}
|
||||||
Ok(joining_chat_id)
|
Ok(joining_chat_id)
|
||||||
}
|
}
|
||||||
@@ -162,14 +165,13 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
|
|||||||
let ts_sort = private_chat_id
|
let ts_sort = private_chat_id
|
||||||
.calc_sort_timestamp(context, 0, sort_to_bottom, received, incoming)
|
.calc_sort_timestamp(context, 0, sort_to_bottom, received, incoming)
|
||||||
.await?;
|
.await?;
|
||||||
let ts_start = time();
|
|
||||||
chat::add_info_msg_with_cmd(
|
chat::add_info_msg_with_cmd(
|
||||||
context,
|
context,
|
||||||
private_chat_id,
|
private_chat_id,
|
||||||
&stock_str::securejoin_wait(context).await,
|
&stock_str::securejoin_wait(context).await,
|
||||||
SystemMessage::SecurejoinWait,
|
SystemMessage::SecurejoinWait,
|
||||||
ts_sort,
|
ts_sort,
|
||||||
Some(ts_start),
|
Some(timestamp),
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
@@ -242,7 +244,8 @@ pub(super) async fn handle_auth_required(
|
|||||||
// so only show it when joining a group and not for a 1:1 chat or broadcast channel.
|
// so only show it when joining a group and not for a 1:1 chat or broadcast channel.
|
||||||
let contact_id = invite.contact_id();
|
let contact_id = invite.contact_id();
|
||||||
let msg = stock_str::secure_join_replies(context, contact_id).await;
|
let msg = stock_str::secure_join_replies(context, contact_id).await;
|
||||||
let chat_id = joining_chat_id(context, &invite, chat_id).await?;
|
let timestamp = message.timestamp_sent;
|
||||||
|
let chat_id = joining_chat_id(context, &invite, chat_id, timestamp).await?;
|
||||||
chat::add_info_msg(context, chat_id, &msg, time()).await?;
|
chat::add_info_msg(context, chat_id, &msg, time()).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -368,6 +371,7 @@ async fn joining_chat_id(
|
|||||||
context: &Context,
|
context: &Context,
|
||||||
invite: &QrInvite,
|
invite: &QrInvite,
|
||||||
alice_chat_id: ChatId,
|
alice_chat_id: ChatId,
|
||||||
|
timestamp: i64,
|
||||||
) -> Result<ChatId> {
|
) -> Result<ChatId> {
|
||||||
match invite {
|
match invite {
|
||||||
QrInvite::Contact { .. } => Ok(alice_chat_id),
|
QrInvite::Contact { .. } => Ok(alice_chat_id),
|
||||||
@@ -391,7 +395,7 @@ async fn joining_chat_id(
|
|||||||
name,
|
name,
|
||||||
Blocked::Not,
|
Blocked::Not,
|
||||||
None,
|
None,
|
||||||
smeared_time(context),
|
timestamp,
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
InBroadcast#Chat#2002: My Channel [2 member(s)] Icon: e9b6c7a78aa2e4f415644f55a553e73.png
|
InBroadcast#Chat#2002: My Channel [2 member(s)] Icon: e9b6c7a78aa2e4f415644f55a553e73.png
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Msg#2004: info (Contact#Contact#Info): Establishing guaranteed end-to-end encryption, please wait… [NOTICED][INFO]
|
|
||||||
Msg#2003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
Msg#2003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
||||||
|
Msg#2004: info (Contact#Contact#Info): Establishing guaranteed end-to-end encryption, please wait… [NOTICED][INFO]
|
||||||
Msg#2007🔒: (Contact#Contact#2001): You joined the channel. [FRESH][INFO]
|
Msg#2007🔒: (Contact#Contact#2001): You joined the channel. [FRESH][INFO]
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
InBroadcast#Chat#2002: Channel [1 member(s)]
|
InBroadcast#Chat#2002: Channel [1 member(s)]
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Msg#2004: info (Contact#Contact#Info): Establishing guaranteed end-to-end encryption, please wait… [NOTICED][INFO]
|
|
||||||
Msg#2003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
Msg#2003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
||||||
|
Msg#2004: info (Contact#Contact#Info): Establishing guaranteed end-to-end encryption, please wait… [NOTICED][INFO]
|
||||||
Msg#2008🔒: (Contact#Contact#2001): You joined the channel. [FRESH][INFO]
|
Msg#2008🔒: (Contact#Contact#2001): You joined the channel. [FRESH][INFO]
|
||||||
Msg#2010🔒: (Contact#Contact#2001): hi [FRESH]
|
Msg#2010🔒: (Contact#Contact#2001): hi [FRESH]
|
||||||
Msg#2011🔒: (Contact#Contact#2001): Member Me removed by alice@example.org. [FRESH][INFO]
|
Msg#2011🔒: (Contact#Contact#2001): Member Me removed by alice@example.org. [FRESH][INFO]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Group#Chat#6002: Group [3 member(s)]
|
Group#Chat#6002: Group [3 member(s)]
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
Msg#6006: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO]
|
||||||
|
Msg#6003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
||||||
Msg#6004: info (Contact#Contact#Info): alice@example.org invited you to join this group.
|
Msg#6004: info (Contact#Contact#Info): alice@example.org invited you to join this group.
|
||||||
|
|
||||||
Waiting for the device of alice@example.org to reply… [NOTICED][INFO]
|
Waiting for the device of alice@example.org to reply… [NOTICED][INFO]
|
||||||
Msg#6006: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO]
|
|
||||||
Msg#6003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
|
||||||
Msg#6008🔒: (Contact#Contact#6001): Member Me added by alice@example.org. [FRESH][INFO]
|
Msg#6008🔒: (Contact#Contact#6001): Member Me added by alice@example.org. [FRESH][INFO]
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
Group#Chat#3002: Group [3 member(s)]
|
Group#Chat#3002: Group [3 member(s)]
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
Msg#3006: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO]
|
||||||
|
Msg#3003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
||||||
Msg#3004: info (Contact#Contact#Info): alice@example.org invited you to join this group.
|
Msg#3004: info (Contact#Contact#Info): alice@example.org invited you to join this group.
|
||||||
|
|
||||||
Waiting for the device of alice@example.org to reply… [NOTICED][INFO]
|
Waiting for the device of alice@example.org to reply… [NOTICED][INFO]
|
||||||
Msg#3006: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO]
|
|
||||||
Msg#3003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
|
||||||
Msg#3008🔒: (Contact#Contact#3002): [FRESH]
|
Msg#3008🔒: (Contact#Contact#3002): [FRESH]
|
||||||
Msg#3009: info (Contact#Contact#Info): Member bob@example.net added. [NOTICED][INFO]
|
Msg#3009: info (Contact#Contact#Info): Member bob@example.net added. [NOTICED][INFO]
|
||||||
Msg#3010🔒: (Contact#Contact#3001): Member Me added by alice@example.org. [FRESH][INFO]
|
Msg#3010🔒: (Contact#Contact#3001): Member Me added by alice@example.org. [FRESH][INFO]
|
||||||
|
|||||||
Reference in New Issue
Block a user