mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
fix logic error: adding a member to a group is okay if a real contact exists or for SELF
This commit is contained in:
@@ -1366,8 +1366,8 @@ pub(crate) fn add_contact_to_chat_ex(
|
|||||||
chat_id
|
chat_id
|
||||||
);
|
);
|
||||||
ensure!(
|
ensure!(
|
||||||
Contact::real_exists_by_id(context, contact_id) && contact_id != DC_CONTACT_ID_SELF,
|
Contact::real_exists_by_id(context, contact_id) || contact_id == DC_CONTACT_ID_SELF,
|
||||||
"invalid contact_id {} for removal in group",
|
"invalid contact_id {} for adding to group",
|
||||||
contact_id
|
contact_id
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1387,10 +1387,10 @@ pub(crate) fn add_contact_to_chat_ex(
|
|||||||
.get_config(Config::ConfiguredAddr)
|
.get_config(Config::ConfiguredAddr)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
if contact.get_addr() == &self_addr {
|
if contact.get_addr() == &self_addr {
|
||||||
|
// ourself is added using DC_CONTACT_ID_SELF, do not add this address explicitly.
|
||||||
|
// if SELF is not in the group, members cannot be added at all.
|
||||||
bail!("invalid attempt to add self e-mail address to group");
|
bail!("invalid attempt to add self e-mail address to group");
|
||||||
}
|
}
|
||||||
// ourself is added using DC_CONTACT_ID_SELF, do not add it explicitly.
|
|
||||||
// if SELF is not in the group, members cannot be added at all.
|
|
||||||
|
|
||||||
if is_contact_in_chat(context, chat_id, contact_id) {
|
if is_contact_in_chat(context, chat_id, contact_id) {
|
||||||
if !from_handshake {
|
if !from_handshake {
|
||||||
|
|||||||
Reference in New Issue
Block a user