Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3917,9 +3917,14 @@ pub(crate) async fn add_contact_to_chat_ex(
chat.typ != Chattype::OutBroadcast || contact_id != ContactId::SELF,
"Cannot add SELF to broadcast channel."
);
let is_encrypted = chat.is_encrypted(context).await?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
let is_encrypted = chat.is_encrypted(context).await?;
let is_chat_encrypted = chat.is_encrypted(context).await?;

ensure!(
chat.is_encrypted(context).await? == contact.is_key_contact(),
"Only key-contacts can be added to encrypted chats"
is_encrypted == contact.is_key_contact(),
if is_encrypted {
Comment on lines +3922 to +3923
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
is_encrypted == contact.is_key_contact(),
if is_encrypted {
is_chat_encrypted == contact.is_key_contact(),
if is_chat_encrypted {

"Only key-contacts can be added to encrypted chats"
} else {
"Only address-contacts can be added to unencrypted chats"
}
);

if !chat.is_self_in_chat(context).await? {
Expand Down
Loading