fix: Make sure that only the channel owner can write into the chat

This commit is contained in:
Hocuri
2025-08-11 15:22:55 +02:00
parent 90d4856a1c
commit 956519cd98
3 changed files with 134 additions and 0 deletions

View File

@@ -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;