Skip to content

Commit

Permalink
Use less error-prone timeout time for channel unban.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Nov 12, 2023
1 parent 413556b commit 55bd922
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions td/telegram/ContactsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12264,10 +12264,13 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
if (c->is_status_changed) {
c->status.update_restrictions();
auto until_date = c->status.get_until_date();
int32 left_time = 0;
double left_time = 0;
if (until_date > 0) {
left_time = until_date - G()->unix_time() + 1;
CHECK(left_time > 0);
left_time = until_date - G()->server_time() + 2;
if (left_time <= 0) {
c->status.update_restrictions();
CHECK(c->status.get_until_date() == 0);
}
}
if (left_time > 0 && left_time < 366 * 86400) {
channel_unban_timeout_.set_timeout_in(channel_id.get(), left_time);
Expand Down

0 comments on commit 55bd922

Please sign in to comment.