mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 02:46:29 +03:00
fix: Make sure that only the channel owner can write into the chat
This commit is contained in:
@@ -1698,6 +1698,15 @@ async fn add_parts(
|
||||
for part in &mut mime_parser.parts {
|
||||
part.param.set(Param::OverrideSenderDisplayname, name);
|
||||
}
|
||||
|
||||
if chat.typ == Chattype::InBroadcast {
|
||||
let s = stock_str::error(context, "This message was not sent by the channel owner")
|
||||
.await;
|
||||
if let Some(part) = mime_parser.parts.first_mut() {
|
||||
part.error = Some(format!("{s}:\n\"{}\"", part.msg));
|
||||
}
|
||||
mime_parser.replace_msg_by_error(&s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3540,6 +3549,16 @@ async fn apply_in_broadcast_changes(
|
||||
) -> Result<GroupChangesInfo> {
|
||||
ensure!(chat.typ == Chattype::InBroadcast);
|
||||
|
||||
if let Some(part) = mime_parser.parts.first() {
|
||||
if let Some(error) = &part.error {
|
||||
warn!(
|
||||
context,
|
||||
"Not applying broadcast changes from message with error: {error}"
|
||||
);
|
||||
return Ok(GroupChangesInfo::default());
|
||||
}
|
||||
}
|
||||
|
||||
let mut send_event_chat_modified = false;
|
||||
let mut better_msg = None;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user