Allow to change show_message_sender.

This commit is contained in:
levlam 2024-08-07 16:16:55 +03:00
parent cc21a58abf
commit 799e6010b4
5 changed files with 20 additions and 10 deletions

View File

@ -10907,8 +10907,11 @@ setSupergroupCustomEmojiStickerSet supergroup_id:int53 custom_emoji_sticker_set_
//@unrestrict_boost_count New value of the unrestrict_boost_count supergroup setting; 0-8. Use 0 to remove the setting
setSupergroupUnrestrictBoostCount supergroup_id:int53 unrestrict_boost_count:int32 = Ok;
//@description Toggles whether sender signature is added to sent messages in a channel; requires can_change_info member right @supergroup_id Identifier of the channel @sign_messages New value of sign_messages
toggleSupergroupSignMessages supergroup_id:int53 sign_messages:Bool = Ok;
//@description Toggles whether sender signature or link to the account is added to sent messages in a channel; requires can_change_info member right
//@supergroup_id Identifier of the channel
//@sign_messages New value of sign_messages
//@show_message_sender New value of show_message_sender
toggleSupergroupSignMessages supergroup_id:int53 sign_messages:Bool show_message_sender:Bool = Ok;
//@description Toggles whether joining is mandatory to send messages to a discussion supergroup; requires can_restrict_members administrator right
//@supergroup_id Identifier of the supergroup that isn't a broadcast group

View File

@ -569,7 +569,7 @@ class ToggleChannelSignaturesQuery final : public Td::ResultHandler {
explicit ToggleChannelSignaturesQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(ChannelId channel_id, bool sign_messages) {
void send(ChannelId channel_id, bool sign_messages, bool show_message_sender) {
channel_id_ = channel_id;
auto input_channel = td_->chat_manager_->get_input_channel(channel_id);
CHECK(input_channel != nullptr);
@ -577,6 +577,9 @@ class ToggleChannelSignaturesQuery final : public Td::ResultHandler {
if (sign_messages) {
flags |= telegram_api::channels_toggleSignatures::SIGNATURES_ENABLED_MASK;
}
if (show_message_sender) {
flags |= telegram_api::channels_toggleSignatures::PROFILES_ENABLED_MASK;
}
send_query(G()->net_query_creator().create(
telegram_api::channels_toggleSignatures(flags, false /*ignored*/, false /*ignored*/, std::move(input_channel)),
{{channel_id}}));
@ -3107,7 +3110,8 @@ void ChatManager::set_channel_unrestrict_boost_count(ChannelId channel_id, int32
->send(channel_id, unrestrict_boost_count);
}
void ChatManager::toggle_channel_sign_messages(ChannelId channel_id, bool sign_messages, Promise<Unit> &&promise) {
void ChatManager::toggle_channel_sign_messages(ChannelId channel_id, bool sign_messages, bool show_message_sender,
Promise<Unit> &&promise) {
auto c = get_channel(channel_id);
if (c == nullptr) {
return promise.set_error(Status::Error(400, "Supergroup not found"));
@ -3119,7 +3123,8 @@ void ChatManager::toggle_channel_sign_messages(ChannelId channel_id, bool sign_m
return promise.set_error(Status::Error(400, "Not enough rights to toggle channel sign messages"));
}
td_->create_handler<ToggleChannelSignaturesQuery>(std::move(promise))->send(channel_id, sign_messages);
td_->create_handler<ToggleChannelSignaturesQuery>(std::move(promise))
->send(channel_id, sign_messages, show_message_sender);
}
void ChatManager::toggle_channel_join_to_send(ChannelId channel_id, bool join_to_send, Promise<Unit> &&promise) {

View File

@ -243,7 +243,8 @@ class ChatManager final : public Actor {
void set_channel_unrestrict_boost_count(ChannelId channel_id, int32 unrestrict_boost_count, Promise<Unit> &&promise);
void toggle_channel_sign_messages(ChannelId channel_id, bool sign_messages, Promise<Unit> &&promise);
void toggle_channel_sign_messages(ChannelId channel_id, bool sign_messages, bool show_message_sender,
Promise<Unit> &&promise);
void toggle_channel_join_to_send(ChannelId channel_id, bool joint_to_send, Promise<Unit> &&promise);

View File

@ -7737,7 +7737,7 @@ void Td::on_request(uint64 id, const td_api::toggleSupergroupSignMessages &reque
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
chat_manager_->toggle_channel_sign_messages(ChannelId(request.supergroup_id_), request.sign_messages_,
std::move(promise));
request.show_message_sender_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::toggleSupergroupJoinToSendMessages &request) {

View File

@ -6330,9 +6330,10 @@ class CliClient final : public Actor {
} else if (op == "tsgsm") {
string supergroup_id;
bool sign_messages;
get_args(args, supergroup_id, sign_messages);
send_request(
td_api::make_object<td_api::toggleSupergroupSignMessages>(as_supergroup_id(supergroup_id), sign_messages));
bool show_message_sender;
get_args(args, supergroup_id, sign_messages, show_message_sender);
send_request(td_api::make_object<td_api::toggleSupergroupSignMessages>(as_supergroup_id(supergroup_id),
sign_messages, show_message_sender));
} else if (op == "tsgjtsm") {
string supergroup_id;
bool join_to_send_message;