Explicitly pass default_reaction to send_update_default_reaction_type.
This commit is contained in:
parent
ef4f0989b1
commit
fa07382e5b
@ -675,7 +675,10 @@ void get_message_added_reactions(Td *td, FullMessageId full_message_id, string r
|
||||
}
|
||||
|
||||
void set_default_reaction(Td *td, string reaction, Promise<Unit> &&promise) {
|
||||
if (!td->stickers_manager_->is_active_reaction(reaction)) {
|
||||
if (reaction.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Default reaction must be non-empty"));
|
||||
}
|
||||
if (reaction[0] != '#' && !td->stickers_manager_->is_active_reaction(reaction)) {
|
||||
return promise.set_error(Status::Error(400, "Can't set incative reaction as default"));
|
||||
}
|
||||
|
||||
@ -693,8 +696,7 @@ void send_set_default_reaction_query(Td *td) {
|
||||
td->create_handler<SetDefaultReactionQuery>()->send(td->option_manager_->get_option_string("default_reaction"));
|
||||
}
|
||||
|
||||
void send_update_default_reaction_type() {
|
||||
auto default_reaction = G()->get_option_string("default_reaction");
|
||||
void send_update_default_reaction_type(const string &default_reaction) {
|
||||
if (default_reaction.empty()) {
|
||||
LOG(ERROR) << "Have no default reaction";
|
||||
return;
|
||||
|
@ -188,6 +188,6 @@ void set_default_reaction(Td *td, string reaction, Promise<Unit> &&promise);
|
||||
|
||||
void send_set_default_reaction_query(Td *td);
|
||||
|
||||
void send_update_default_reaction_type();
|
||||
void send_update_default_reaction_type(const string &default_reaction);
|
||||
|
||||
} // namespace td
|
||||
|
@ -54,11 +54,10 @@ OptionManager::OptionManager(Td *td)
|
||||
all_options["utc_time_offset"] = PSTRING() << 'I' << Clocks::tz_offset();
|
||||
for (const auto &name_value : all_options) {
|
||||
const string &name = name_value.first;
|
||||
const string &value = name_value.second;
|
||||
options_->set(name, value);
|
||||
options_->set(name, name_value.second);
|
||||
if (!is_internal_option(name)) {
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateOption>(name, get_option_value_object(value)));
|
||||
td_api::make_object<td_api::updateOption>(name, get_option_value_object(name_value.second)));
|
||||
} else if (name == "otherwise_relogin_days") {
|
||||
auto days = narrow_cast<int32>(get_option_integer(name));
|
||||
if (days > 0) {
|
||||
@ -66,7 +65,7 @@ OptionManager::OptionManager(Td *td)
|
||||
send_closure(G()->td(), &Td::send_update, get_update_suggested_actions_object(added_actions, {}));
|
||||
}
|
||||
} else if (name == "default_reaction") {
|
||||
send_update_default_reaction_type();
|
||||
send_update_default_reaction_type(get_option_string(name));
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +319,7 @@ void OptionManager::on_option_updated(Slice name) {
|
||||
break;
|
||||
case 'd':
|
||||
if (name == "default_reaction") {
|
||||
send_update_default_reaction_type();
|
||||
send_update_default_reaction_type(get_option_string(name));
|
||||
}
|
||||
if (name == "dice_emojis") {
|
||||
send_closure(td_->stickers_manager_actor_, &StickersManager::on_update_dice_emojis);
|
||||
|
@ -2216,6 +2216,10 @@ class CliClient final : public Actor {
|
||||
ChatId chat_id;
|
||||
get_args(args, chat_id);
|
||||
send_request(td_api::make_object<td_api::getChatScheduledMessages>(chat_id));
|
||||
} else if (op == "sdrt") {
|
||||
string reaction;
|
||||
get_args(args, reaction);
|
||||
send_request(td_api::make_object<td_api::setDefaultReactionType>(as_reaction_type(reaction)));
|
||||
} else if (op == "gmar") {
|
||||
ChatId chat_id;
|
||||
MessageId message_id;
|
||||
|
Loading…
Reference in New Issue
Block a user