Allow import messages with can_change_info administrator right.

This commit is contained in:
levlam 2021-01-22 23:45:39 +03:00
parent 6ddce1dd7a
commit 60b76e89aa
2 changed files with 9 additions and 9 deletions

View File

@ -4236,11 +4236,11 @@ getRecommendedChatFilters = RecommendedChatFilters;
getChatFilterDefaultIconName filter:chatFilter = Text; getChatFilterDefaultIconName filter:chatFilter = Text;
//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights //@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right
//@chat_id Chat identifier @title New title of the chat; 1-128 characters //@chat_id Chat identifier @title New title of the chat; 1-128 characters
setChatTitle chat_id:int53 title:string = Ok; setChatTitle chat_id:int53 title:string = Ok;
//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info rights //@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right
//@chat_id Chat identifier @photo New chat photo. Pass null to delete the chat photo //@chat_id Chat identifier @photo New chat photo. Pass null to delete the chat photo
setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok; setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok;
@ -4264,10 +4264,10 @@ toggleChatDefaultDisableNotification chat_id:int53 default_disable_notification:
//@description Changes application-specific data associated with a chat @chat_id Chat identifier @client_data New value of client_data //@description Changes application-specific data associated with a chat @chat_id Chat identifier @client_data New value of client_data
setChatClientData chat_id:int53 client_data:string = Ok; setChatClientData chat_id:int53 client_data:string = Ok;
//@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights @chat_id Identifier of the chat @param_description New chat description; 0-255 characters //@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right @chat_id Identifier of the chat @param_description New chat description; 0-255 characters
setChatDescription chat_id:int53 description:string = Ok; setChatDescription chat_id:int53 description:string = Ok;
//@description Changes the discussion group of a channel chat; requires can_change_info rights in the channel if it is specified @chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) @discussion_chat_id Identifier of a new channel's discussion group. Use 0 to remove the discussion group. //@description Changes the discussion group of a channel chat; requires can_change_info administrator right in the channel if it is specified @chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) @discussion_chat_id Identifier of a new channel's discussion group. Use 0 to remove the discussion group.
//-Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that //-Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that
setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok; setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok;
@ -4409,7 +4409,7 @@ deleteFile file_id:int32 = Ok;
getMessageFileType message_file_head:string = MessageFileType; getMessageFileType message_file_head:string = MessageFileType;
//@description Imports messages exported from another app //@description Imports messages exported from another app
//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a created supergroup chat //@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right
//@message_file File with messages to import. Only inputFileLocal and inputFileGenerated are supported. The file must not be previously uploaded //@message_file File with messages to import. Only inputFileLocal and inputFileGenerated are supported. The file must not be previously uploaded
//@attached_files Files used in the imported messages. Only inputFileLocal and inputFileGenerated are supported. The files must not be previously uploaded //@attached_files Files used in the imported messages. Only inputFileLocal and inputFileGenerated are supported. The files must not be previously uploaded
importMessages chat_id:int53 message_file:InputFile attached_files:vector<InputFile> = Ok; importMessages chat_id:int53 message_file:InputFile attached_files:vector<InputFile> = Ok;
@ -4730,13 +4730,13 @@ disconnectAllWebsites = Ok;
//@description Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username //@description Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username
setSupergroupUsername supergroup_id:int32 username:string = Ok; setSupergroupUsername supergroup_id:int32 username:string = Ok;
//@description Changes the sticker set of a supergroup; requires can_change_info rights @supergroup_id Identifier of the supergroup @sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set //@description Changes the sticker set of a supergroup; requires can_change_info administrator right @supergroup_id Identifier of the supergroup @sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set
setSupergroupStickerSet supergroup_id:int32 sticker_set_id:int64 = Ok; setSupergroupStickerSet supergroup_id:int32 sticker_set_id:int64 = Ok;
//@description Toggles sender signatures messages sent in a channel; requires can_change_info rights @supergroup_id Identifier of the channel @sign_messages New value of sign_messages //@description Toggles sender signatures messages sent in a channel; requires can_change_info administrator right @supergroup_id Identifier of the channel @sign_messages New value of sign_messages
toggleSupergroupSignMessages supergroup_id:int32 sign_messages:Bool = Ok; toggleSupergroupSignMessages supergroup_id:int32 sign_messages:Bool = Ok;
//@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available //@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info administrator right @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available
toggleSupergroupIsAllHistoryAvailable supergroup_id:int32 is_all_history_available:Bool = Ok; toggleSupergroupIsAllHistoryAvailable supergroup_id:int32 is_all_history_available:Bool = Ok;
//@description Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup @supergroup_id Supergroup identifier @user_id User identifier @message_ids Identifiers of messages sent in the supergroup by the user. This list must be non-empty //@description Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup @supergroup_id Supergroup identifier @user_id User identifier @message_ids Identifiers of messages sent in the supergroup by the user. This list must be non-empty

View File

@ -26472,7 +26472,7 @@ void MessagesManager::import_messages(DialogId dialog_id, const td_api::object_p
if (is_broadcast_channel(dialog_id)) { if (is_broadcast_channel(dialog_id)) {
return promise.set_error(Status::Error(400, "Can't import messages to channels")); return promise.set_error(Status::Error(400, "Can't import messages to channels"));
} }
if (!td_->contacts_manager_->get_channel_status(dialog_id.get_channel_id()).is_creator()) { if (!td_->contacts_manager_->get_channel_status(dialog_id.get_channel_id()).can_change_info_and_settings()) {
return promise.set_error(Status::Error(400, "Not enough rights to import messages")); return promise.set_error(Status::Error(400, "Not enough rights to import messages"));
} }
break; break;