2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Reload poll data each 30 seconds without update.

This commit is contained in:
John Preston
2018-12-24 21:03:53 +04:00
parent b6a3bb4080
commit 6f176803d4
6 changed files with 40 additions and 0 deletions

View File

@@ -5437,6 +5437,24 @@ void ApiWrap::closePoll(FullMsgId itemId) {
_pollCloseRequestIds.emplace(itemId, requestId);
}
void ApiWrap::reloadPollResults(not_null<HistoryItem*> item) {
const auto itemId = item->fullId();
if (!IsServerMsgId(item->id)
|| _pollReloadRequestIds.contains(itemId)) {
return;
}
const auto requestId = request(MTPmessages_GetPollResults(
item->history()->peer->input,
MTP_int(item->id)
)).done([=](const MTPUpdates &result) {
_pollReloadRequestIds.erase(itemId);
applyUpdates(result);
}).fail([=](const RPCError &error) {
_pollReloadRequestIds.erase(itemId);
}).send();
_pollReloadRequestIds.emplace(itemId, requestId);
}
void ApiWrap::readServerHistory(not_null<History*> history) {
if (history->unreadCount()) {
readServerHistoryForce(history);