Improve slow mode.
GitOrigin-RevId: 068774033f5c84165e4833dafa29789d307ab97b
This commit is contained in:
parent
97cdacff7b
commit
0f353009f8
@ -1395,7 +1395,15 @@ class ToggleSlowModeQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_error(uint64 id, Status status) override {
|
void on_error(uint64 id, Status status) override {
|
||||||
|
if (status.message() == "CHAT_NOT_MODIFIED") {
|
||||||
|
td->contacts_manager_->on_update_channel_slow_mode_delay(channel_id_, slow_mode_delay_);
|
||||||
|
if (!td->auth_manager_->is_bot()) {
|
||||||
|
promise_.set_value(Unit());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
td->contacts_manager_->on_get_channel_error(channel_id_, status, "ToggleSlowModeQuery");
|
td->contacts_manager_->on_get_channel_error(channel_id_, status, "ToggleSlowModeQuery");
|
||||||
|
}
|
||||||
promise_.set_error(std::move(status));
|
promise_.set_error(std::move(status));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -9760,7 +9768,7 @@ void ContactsManager::on_update_channel_full_slow_mode_delay(ChannelFull *channe
|
|||||||
Channel *c = get_channel(channel_id);
|
Channel *c = get_channel(channel_id);
|
||||||
CHECK(c != nullptr);
|
CHECK(c != nullptr);
|
||||||
bool is_slow_mode_enabled = slow_mode_delay != 0;
|
bool is_slow_mode_enabled = slow_mode_delay != 0;
|
||||||
if (is_slow_mode_enabled == c->is_slow_mode_enabled) {
|
if (is_slow_mode_enabled != c->is_slow_mode_enabled) {
|
||||||
c->is_slow_mode_enabled = is_slow_mode_enabled;
|
c->is_slow_mode_enabled = is_slow_mode_enabled;
|
||||||
c->is_changed = true;
|
c->is_changed = true;
|
||||||
update_channel(c, channel_id);
|
update_channel(c, channel_id);
|
||||||
|
@ -24764,7 +24764,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
|||||||
add_message_to_database(d, m, "add_message_to_dialog");
|
add_message_to_database(d, m, "add_message_to_dialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*need_update && dialog_id.get_type() == DialogType::Channel) {
|
if (from_update && dialog_id.get_type() == DialogType::Channel) {
|
||||||
auto now = max(G()->unix_time_cached(), m->date);
|
auto now = max(G()->unix_time_cached(), m->date);
|
||||||
if (m->date < now - 2 * 86400 && Slice(source) == Slice("updateNewChannelMessage")) {
|
if (m->date < now - 2 * 86400 && Slice(source) == Slice("updateNewChannelMessage")) {
|
||||||
// if the message is pretty old, we might have missed the update that the message has already been read
|
// if the message is pretty old, we might have missed the update that the message has already been read
|
||||||
|
Loading…
Reference in New Issue
Block a user