Skip to content

refactor: fix log msg in add_contact_to_chat_ex #7016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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