Never drop correct poll option and quiz explanation.
GitOrigin-RevId: 5cd600cd0bb1a5c4200eb74d62ace5da6425ca7d
This commit is contained in:
parent
fc3a8105a3
commit
38de2b016e
|
@ -1478,17 +1478,29 @@ PollId PollManager::on_get_poll(PollId poll_id, tl_object_ptr<telegram_api::poll
|
||||||
|
|
||||||
if (poll->is_quiz) {
|
if (poll->is_quiz) {
|
||||||
if (poll->correct_option_id != correct_option_id) {
|
if (poll->correct_option_id != correct_option_id) {
|
||||||
poll->correct_option_id = correct_option_id;
|
if (correct_option_id == -1 && poll->correct_option_id != -1) {
|
||||||
is_changed = true;
|
LOG(ERROR) << "Can't change correct option of " << poll_id << " from " << poll->correct_option_id << " to "
|
||||||
|
<< correct_option_id;
|
||||||
|
} else {
|
||||||
|
poll->correct_option_id = correct_option_id;
|
||||||
|
is_changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (poll->explanation != explanation && (!is_min || poll->is_closed)) {
|
if (poll->explanation != explanation && (!is_min || poll->is_closed)) {
|
||||||
poll->explanation = std::move(explanation);
|
if (explanation.text.empty() && !poll->explanation.text.empty()) {
|
||||||
is_changed = true;
|
LOG(ERROR) << "Can't change known " << poll_id << " explanation to empty";
|
||||||
|
} else {
|
||||||
|
poll->explanation = std::move(explanation);
|
||||||
|
is_changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (correct_option_id != -1) {
|
if (correct_option_id != -1) {
|
||||||
LOG(ERROR) << "Receive correct option " << correct_option_id << " in non-quiz " << poll_id;
|
LOG(ERROR) << "Receive correct option " << correct_option_id << " in non-quiz " << poll_id;
|
||||||
}
|
}
|
||||||
|
if (!explanation.text.empty()) {
|
||||||
|
LOG(ERROR) << "Receive explanation " << explanation << " in non-quiz " << poll_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<UserId> recent_voter_user_ids;
|
vector<UserId> recent_voter_user_ids;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user