Disallow message history hiding in forums.

This commit is contained in:
levlam 2022-10-25 12:13:34 +03:00
parent 9b304557c2
commit f9acc95d3d
2 changed files with 4 additions and 1 deletions

View File

@ -759,7 +759,7 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe
//@can_set_sticker_set True, if the supergroup sticker set can be changed
//@can_set_location True, if the supergroup location can be changed
//@can_get_statistics True, if the supergroup or channel statistics are available
//@is_all_history_available True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators
//@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available for chat administrators
//@sticker_set_id Identifier of the supergroup sticker set; 0 if none
//@location Location to which the supergroup is connected; may be null
//@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only

View File

@ -7222,6 +7222,9 @@ void ContactsManager::toggle_channel_is_all_history_available(ChannelId channel_
if (get_channel_type(c) != ChannelType::Megagroup) {
return promise.set_error(Status::Error(400, "Message history can be hidden in supergroups only"));
}
if (c->is_forum && !is_all_history_available) {
return promise.set_error(Status::Error(400, "Message history can't be hidden in forum supergroups"));
}
if (c->has_linked_channel && !is_all_history_available) {
return promise.set_error(Status::Error(400, "Message history can't be hidden in discussion supergroups"));
}