Send updates when ignored_restriction_reasons changes.
GitOrigin-RevId: 8c30b41dfb3a34c9eca3d8a7be4622ee172593de
This commit is contained in:
parent
98782fb644
commit
cefc10e0ba
@ -992,7 +992,8 @@ void ConfigManager::request_config_from_dc_impl(DcId dc_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConfigManager::set_ignore_sensitive_content_restrictions(bool ignore_sensitive_content_restrictions) {
|
void ConfigManager::set_ignore_sensitive_content_restrictions(bool ignore_sensitive_content_restrictions) {
|
||||||
G()->shared_config().set_option_boolean("ignore_sensitive_content_restrictions", ignore_sensitive_content_restrictions);
|
G()->shared_config().set_option_boolean("ignore_sensitive_content_restrictions",
|
||||||
|
ignore_sensitive_content_restrictions);
|
||||||
bool have_ignored_restriction_reasons = G()->shared_config().have_option("ignored_restriction_reasons");
|
bool have_ignored_restriction_reasons = G()->shared_config().have_option("ignored_restriction_reasons");
|
||||||
if (have_ignored_restriction_reasons != ignore_sensitive_content_restrictions) {
|
if (have_ignored_restriction_reasons != ignore_sensitive_content_restrictions) {
|
||||||
get_app_config(Auto());
|
get_app_config(Auto());
|
||||||
@ -1351,6 +1352,7 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
|
|||||||
shared_config.set_option_string("default_ton_blockchain_name", wallet_blockchain_name);
|
shared_config.set_option_string("default_ton_blockchain_name", wallet_blockchain_name);
|
||||||
shared_config.set_option_string("default_ton_blockchain_config", wallet_config);
|
shared_config.set_option_string("default_ton_blockchain_config", wallet_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ignored_restriction_reasons.empty()) {
|
if (ignored_restriction_reasons.empty()) {
|
||||||
shared_config.set_option_empty("ignored_restriction_reasons");
|
shared_config.set_option_empty("ignored_restriction_reasons");
|
||||||
|
|
||||||
|
@ -7875,6 +7875,13 @@ void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, boo
|
|||||||
if (u->is_default_permissions_changed) {
|
if (u->is_default_permissions_changed) {
|
||||||
td_->messages_manager_->on_dialog_permissions_updated(DialogId(user_id));
|
td_->messages_manager_->on_dialog_permissions_updated(DialogId(user_id));
|
||||||
}
|
}
|
||||||
|
if (!td_->auth_manager_->is_bot()) {
|
||||||
|
if (u->restriction_reasons.empty()) {
|
||||||
|
restricted_user_ids_.erase(user_id);
|
||||||
|
} else {
|
||||||
|
restricted_user_ids_.insert(user_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u->is_name_changed = false;
|
u->is_name_changed = false;
|
||||||
u->is_username_changed = false;
|
u->is_username_changed = false;
|
||||||
@ -8042,6 +8049,14 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
|
|||||||
if (c->is_default_permissions_changed) {
|
if (c->is_default_permissions_changed) {
|
||||||
td_->messages_manager_->on_dialog_permissions_updated(DialogId(channel_id));
|
td_->messages_manager_->on_dialog_permissions_updated(DialogId(channel_id));
|
||||||
}
|
}
|
||||||
|
if (!td_->auth_manager_->is_bot()) {
|
||||||
|
if (c->restriction_reasons.empty()) {
|
||||||
|
restricted_channel_ids_.erase(channel_id);
|
||||||
|
} else {
|
||||||
|
restricted_channel_ids_.insert(channel_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c->is_photo_changed = false;
|
c->is_photo_changed = false;
|
||||||
c->is_title_changed = false;
|
c->is_title_changed = false;
|
||||||
c->is_default_permissions_changed = false;
|
c->is_default_permissions_changed = false;
|
||||||
@ -9051,6 +9066,18 @@ void ContactsManager::on_update_user_full_need_phone_number_privacy_exception(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::on_ignored_restriction_reasons_changed() {
|
||||||
|
for (auto user_id : restricted_user_ids_) {
|
||||||
|
send_closure(G()->td(), &Td::send_update,
|
||||||
|
td_api::make_object<td_api::updateUser>(get_user_object(user_id, get_user(user_id))));
|
||||||
|
}
|
||||||
|
for (auto channel_id : restricted_channel_ids_) {
|
||||||
|
send_closure(
|
||||||
|
G()->td(), &Td::send_update,
|
||||||
|
td_api::make_object<td_api::updateSupergroup>(get_supergroup_object(channel_id, get_channel(channel_id))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::on_delete_profile_photo(int64 profile_photo_id, Promise<Unit> promise) {
|
void ContactsManager::on_delete_profile_photo(int64 profile_photo_id, Promise<Unit> promise) {
|
||||||
UserId my_id = get_my_id();
|
UserId my_id = get_my_id();
|
||||||
|
|
||||||
|
@ -175,6 +175,8 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
void on_delete_profile_photo(int64 profile_photo_id, Promise<Unit> promise);
|
void on_delete_profile_photo(int64 profile_photo_id, Promise<Unit> promise);
|
||||||
|
|
||||||
|
void on_ignored_restriction_reasons_changed();
|
||||||
|
|
||||||
void on_get_chat_participants(tl_object_ptr<telegram_api::ChatParticipants> &&participants, bool from_update);
|
void on_get_chat_participants(tl_object_ptr<telegram_api::ChatParticipants> &&participants, bool from_update);
|
||||||
void on_update_chat_add_user(ChatId chat_id, UserId inviter_user_id, UserId user_id, int32 date, int32 version);
|
void on_update_chat_add_user(ChatId chat_id, UserId inviter_user_id, UserId user_id, int32 date, int32 version);
|
||||||
void on_update_chat_description(ChatId chat_id, string &&description);
|
void on_update_chat_description(ChatId chat_id, string &&description);
|
||||||
@ -1418,6 +1420,9 @@ class ContactsManager : public Actor {
|
|||||||
vector<DialogNearby> users_nearby_;
|
vector<DialogNearby> users_nearby_;
|
||||||
vector<DialogNearby> channels_nearby_;
|
vector<DialogNearby> channels_nearby_;
|
||||||
|
|
||||||
|
std::unordered_set<UserId, UserIdHash> restricted_user_ids_;
|
||||||
|
std::unordered_set<ChannelId, ChannelIdHash> restricted_channel_ids_;
|
||||||
|
|
||||||
vector<Contact> next_all_imported_contacts_;
|
vector<Contact> next_all_imported_contacts_;
|
||||||
vector<size_t> imported_contacts_unique_id_;
|
vector<size_t> imported_contacts_unique_id_;
|
||||||
vector<size_t> imported_contacts_pos_;
|
vector<size_t> imported_contacts_pos_;
|
||||||
|
@ -3873,6 +3873,8 @@ void Td::on_config_option_updated(const string &name) {
|
|||||||
return send_closure(notification_manager_actor_, &NotificationManager::on_notification_cloud_delay_changed);
|
return send_closure(notification_manager_actor_, &NotificationManager::on_notification_cloud_delay_changed);
|
||||||
} else if (name == "notification_default_delay_ms") {
|
} else if (name == "notification_default_delay_ms") {
|
||||||
return send_closure(notification_manager_actor_, &NotificationManager::on_notification_default_delay_changed);
|
return send_closure(notification_manager_actor_, &NotificationManager::on_notification_default_delay_changed);
|
||||||
|
} else if (name == "ignored_restriction_reasons") {
|
||||||
|
return send_closure(contacts_manager_actor_, &ContactsManager::on_ignored_restriction_reasons_changed);
|
||||||
} else if (is_internal_config_option(name)) {
|
} else if (is_internal_config_option(name)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user