mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
fix: stop using leftgrps table
This commit is contained in:
20
src/chat.rs
20
src/chat.rs
@@ -3881,7 +3881,6 @@ pub async fn remove_contact_from_chat(
|
||||
|
||||
if contact_id == ContactId::SELF {
|
||||
res?;
|
||||
set_group_explicitly_left(context, &chat.grpid).await?;
|
||||
} else if let Err(e) = res {
|
||||
warn!(
|
||||
context,
|
||||
@@ -3935,25 +3934,6 @@ async fn send_member_removal_msg(
|
||||
send_msg(context, chat.id, &mut msg).await
|
||||
}
|
||||
|
||||
async fn set_group_explicitly_left(context: &Context, grpid: &str) -> Result<()> {
|
||||
if !is_group_explicitly_left(context, grpid).await? {
|
||||
context
|
||||
.sql
|
||||
.execute("INSERT INTO leftgrps (grpid) VALUES(?);", (grpid,))
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn is_group_explicitly_left(context: &Context, grpid: &str) -> Result<bool> {
|
||||
let exists = context
|
||||
.sql
|
||||
.exists("SELECT COUNT(*) FROM leftgrps WHERE grpid=?;", (grpid,))
|
||||
.await?;
|
||||
Ok(exists)
|
||||
}
|
||||
|
||||
/// Sets group or mailing list chat name.
|
||||
pub async fn set_chat_name(context: &Context, chat_id: ChatId, new_name: &str) -> Result<()> {
|
||||
rename_ex(context, Sync, chat_id, new_name).await
|
||||
|
||||
Reference in New Issue
Block a user