Really fix updating of closed polls.
GitOrigin-RevId: a32c186adb947b909fbdeb68a58d3b98fb8e33ec
This commit is contained in:
parent
6c9659dec4
commit
777e26dd77
@ -1310,6 +1310,7 @@ PollId PollManager::on_get_poll(PollId poll_id, tl_object_ptr<telegram_api::poll
|
||||
}
|
||||
CHECK(poll != nullptr);
|
||||
|
||||
bool poll_server_is_closed = false;
|
||||
if (poll_server != nullptr) {
|
||||
if (poll->question != poll_server->question_) {
|
||||
poll->question = std::move(poll_server->question_);
|
||||
@ -1332,12 +1333,12 @@ PollId PollManager::on_get_poll(PollId poll_id, tl_object_ptr<telegram_api::poll
|
||||
}
|
||||
}
|
||||
}
|
||||
bool is_closed = (poll_server->flags_ & telegram_api::poll::CLOSED_MASK) != 0;
|
||||
if (is_closed && !poll->is_closed) {
|
||||
poll->is_closed = is_closed;
|
||||
poll_server_is_closed = (poll_server->flags_ & telegram_api::poll::CLOSED_MASK) != 0;
|
||||
if (poll_server_is_closed && !poll->is_closed) {
|
||||
poll->is_closed = poll_server_is_closed;
|
||||
is_changed = true;
|
||||
}
|
||||
if (is_closed && !poll->is_updated_after_close) {
|
||||
if (poll_server_is_closed && !poll->is_updated_after_close) {
|
||||
poll->is_updated_after_close = true;
|
||||
is_changed = true;
|
||||
}
|
||||
@ -1416,7 +1417,7 @@ PollId PollManager::on_get_poll(PollId poll_id, tl_object_ptr<telegram_api::poll
|
||||
is_changed = true;
|
||||
}
|
||||
}
|
||||
if (!is_min || (poll->is_closed && poll->is_updated_after_close)) {
|
||||
if (!is_min || poll_server_is_closed) {
|
||||
bool is_correct = (poll_result->flags_ & telegram_api::pollAnswerVoters::CORRECT_MASK) != 0;
|
||||
if (is_correct) {
|
||||
if (correct_option_id != -1) {
|
||||
@ -1486,7 +1487,7 @@ PollId PollManager::on_get_poll(PollId poll_id, tl_object_ptr<telegram_api::poll
|
||||
is_changed = true;
|
||||
}
|
||||
}
|
||||
if (poll->explanation != explanation && (!is_min || (poll->is_closed && poll->is_updated_after_close))) {
|
||||
if (poll->explanation != explanation && (!is_min || poll_server_is_closed)) {
|
||||
if (explanation.text.empty() && !poll->explanation.text.empty()) {
|
||||
LOG(ERROR) << "Can't change known " << poll_id << " explanation to empty";
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user