fix(jsonrpc): fix ChatListItem::is_self_in_group

Make it return the correct value for non-Group chats.

This also should improve performance, thanks to the fact that
we now don't have to query all the chat's contacts.
Instead we only need confirm that self-contact
is among the group members, and only when the chat type is `Group`.
This commit is contained in:
WofWca
2025-10-21 17:22:44 +04:00
committed by Hocuri
parent ec3f765727
commit 129137b5de
3 changed files with 11 additions and 7 deletions

View File

@@ -1494,7 +1494,7 @@ impl Chat {
/// Checks if the user is part of a chat
/// and has basically the permissions to edit the chat therefore.
/// The function does not check if the chat type allows editing of concrete elements.
pub(crate) async fn is_self_in_chat(&self, context: &Context) -> Result<bool> {
pub async fn is_self_in_chat(&self, context: &Context) -> Result<bool> {
match self.typ {
Chattype::Single | Chattype::OutBroadcast | Chattype::Mailinglist => Ok(true),
Chattype::Group => is_contact_in_chat(context, self.id, ContactId::SELF).await,