mirror of
https://github.com/chatmail/core.git
synced 2026-05-12 19:36:32 +03:00
fix: accept WebXDC updates in mailing lists
This commit is contained in:
@@ -13,6 +13,7 @@ use serde_json::Value;
|
|||||||
use tokio::io::AsyncReadExt;
|
use tokio::io::AsyncReadExt;
|
||||||
|
|
||||||
use crate::chat::Chat;
|
use crate::chat::Chat;
|
||||||
|
use crate::constants::Chattype;
|
||||||
use crate::contact::ContactId;
|
use crate::contact::ContactId;
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::download::DownloadState;
|
use crate::download::DownloadState;
|
||||||
@@ -560,6 +561,7 @@ impl Context {
|
|||||||
json: &str,
|
json: &str,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let msg = Message::load_from_db(self, msg_id).await?;
|
let msg = Message::load_from_db(self, msg_id).await?;
|
||||||
|
let chat_id = msg.chat_id;
|
||||||
let (timestamp, mut instance, can_info_msg) = if msg.viewtype == Viewtype::Webxdc {
|
let (timestamp, mut instance, can_info_msg) = if msg.viewtype == Viewtype::Webxdc {
|
||||||
(msg.timestamp_sort, msg, false)
|
(msg.timestamp_sort, msg, false)
|
||||||
} else if let Some(parent) = msg.parent(self).await? {
|
} else if let Some(parent) = msg.parent(self).await? {
|
||||||
@@ -577,7 +579,14 @@ impl Context {
|
|||||||
if from_id != ContactId::SELF
|
if from_id != ContactId::SELF
|
||||||
&& !chat::is_contact_in_chat(self, instance.chat_id, from_id).await?
|
&& !chat::is_contact_in_chat(self, instance.chat_id, from_id).await?
|
||||||
{
|
{
|
||||||
bail!("receive_status_update: status sender not chat member.")
|
let chat_type: Chattype = self
|
||||||
|
.sql
|
||||||
|
.query_get_value("SELECT type FROM chats WHERE id=?", (chat_id,))
|
||||||
|
.await?
|
||||||
|
.with_context(|| format!("Chat type for chat {chat_id} not found"))?;
|
||||||
|
if chat_type != Chattype::Mailinglist {
|
||||||
|
bail!("receive_status_update: status sender not chat member.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let updates: StatusUpdates = serde_json::from_str(json)?;
|
let updates: StatusUpdates = serde_json::from_str(json)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user