mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
Remove rarely-used function is_any_broadcast()
This commit is contained in:
14
src/chat.rs
14
src/chat.rs
@@ -601,7 +601,7 @@ impl ChatId {
|
|||||||
|| chat.is_self_talk()
|
|| chat.is_self_talk()
|
||||||
|| (!chat.can_send(context).await? && !chat.is_contact_request())
|
|| (!chat.can_send(context).await? && !chat.is_contact_request())
|
||||||
// For chattype InBrodacast, the info message is added when the member-added message is received
|
// For chattype InBrodacast, the info message is added when the member-added message is received
|
||||||
// by directly calling add_encrypted_msg():
|
// by directly calling add_encrypted_msg()
|
||||||
|| chat.typ == Chattype::InBroadcast
|
|| chat.typ == Chattype::InBroadcast
|
||||||
|| chat.blocked == Blocked::Yes
|
|| chat.blocked == Blocked::Yes
|
||||||
{
|
{
|
||||||
@@ -1663,13 +1663,6 @@ impl Chat {
|
|||||||
self.typ == Chattype::OutBroadcast
|
self.typ == Chattype::OutBroadcast
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the chat is a broadcast channel,
|
|
||||||
/// regardless of whether self is on the sending
|
|
||||||
/// or receiving side.
|
|
||||||
pub fn is_any_broadcast(&self) -> bool {
|
|
||||||
matches!(self.typ, Chattype::OutBroadcast | Chattype::InBroadcast)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns None if user can send messages to this chat.
|
/// Returns None if user can send messages to this chat.
|
||||||
///
|
///
|
||||||
/// Otherwise returns a reason useful for logging.
|
/// Otherwise returns a reason useful for logging.
|
||||||
@@ -4283,7 +4276,10 @@ pub async fn remove_contact_from_chat(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if chat.typ == Chattype::Group || chat.is_any_broadcast() {
|
if matches!(
|
||||||
|
chat.typ,
|
||||||
|
Chattype::Group | Chattype::OutBroadcast | Chattype::InBroadcast
|
||||||
|
) {
|
||||||
if !chat.is_self_in_chat(context).await? {
|
if !chat.is_self_in_chat(context).await? {
|
||||||
let err_msg = format!(
|
let err_msg = format!(
|
||||||
"Cannot remove contact {contact_id} from chat {chat_id}: self not in group."
|
"Cannot remove contact {contact_id} from chat {chat_id}: self not in group."
|
||||||
|
|||||||
Reference in New Issue
Block a user