| 150 | } |
| 151 | |
| 152 | void UnreadThings::requestReactions( |
| 153 | not_null<Data::Thread*> thread, |
| 154 | int loaded) { |
| 155 | if (_reactionsRequests.contains(thread)) { |
| 156 | return; |
| 157 | } |
| 158 | const auto offsetId = loaded |
| 159 | ? std::max(thread->unreadReactions().maxLoaded(), MsgId(1)) |
| 160 | : MsgId(1); |
| 161 | const auto limit = loaded ? kNextRequestLimit : kFirstRequestLimit; |
| 162 | const auto addOffset = loaded ? -(limit + 1) : -limit; |
| 163 | const auto maxId = 0; |
| 164 | const auto minId = 0; |
| 165 | const auto history = thread->owningHistory(); |
| 166 | const auto sublist = thread->asSublist(); |
| 167 | const auto topic = thread->asTopic(); |
| 168 | using Flag = MTPmessages_GetUnreadReactions::Flag; |
| 169 | const auto requestId = _api->request(MTPmessages_GetUnreadReactions( |
| 170 | MTP_flags((topic ? Flag::f_top_msg_id : Flag()) |
| 171 | | (sublist ? Flag::f_saved_peer_id : Flag())), |
| 172 | history->peer->input(), |
| 173 | MTP_int(topic ? topic->rootId() : 0), |
| 174 | (sublist ? sublist->sublistPeer()->input() : MTPInputPeer()), |
| 175 | MTP_int(offsetId), |
| 176 | MTP_int(addOffset), |
| 177 | MTP_int(limit), |
| 178 | MTP_int(maxId), |
| 179 | MTP_int(minId) |
| 180 | )).done([=](const MTPmessages_Messages &result) { |
| 181 | _reactionsRequests.remove(thread); |
| 182 | thread->unreadReactions().addSlice(result, loaded); |
| 183 | }).fail([=] { |
| 184 | _reactionsRequests.remove(thread); |
| 185 | }).send(); |
| 186 | _reactionsRequests.emplace(thread, requestId); |
| 187 | } |
| 188 | |
| 189 | void UnreadThings::requestPollVotes( |
| 190 | not_null<Data::Thread*> thread, |
nothing calls this directly
no test coverage detected