2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Save recent requester userIds from API.

This commit is contained in:
John Preston
2021-10-27 09:57:37 +04:00
parent f839c7f2bb
commit 36271d6b85
5 changed files with 61 additions and 12 deletions

View File

@@ -147,7 +147,7 @@ void ChatData::setAdminRights(ChatAdminRights rights) {
}
_adminRights.set(rights);
if (!canHaveInviteLink()) {
setPendingRequestsCount(0);
setPendingRequestsCount(0, std::vector<UserId>{});
}
session().changes().peerUpdated(
this,
@@ -261,9 +261,23 @@ void ChatData::setBotCommands(
}
}
void ChatData::setPendingRequestsCount(int count) {
if (_pendingRequestsCount != count) {
void ChatData::setPendingRequestsCount(
int count,
const QVector<MTPlong> &recentRequesters) {
setPendingRequestsCount(count, ranges::views::all(
recentRequesters
) | ranges::views::transform([&](const MTPlong &value) {
return UserId(value);
}) | ranges::to_vector);
}
void ChatData::setPendingRequestsCount(
int count,
std::vector<UserId> recentRequesters) {
if (_pendingRequestsCount != count
|| _recentRequesters != recentRequesters) {
_pendingRequestsCount = count;
_recentRequesters = std::move(recentRequesters);
session().changes().peerUpdated(this, UpdateFlag::PendingRequests);
}
}
@@ -442,7 +456,8 @@ void ApplyChatUpdate(not_null<ChatData*> chat, const MTPDchatFull &update) {
chat->fullUpdated();
chat->setAbout(qs(update.vabout()));
chat->setPendingRequestsCount(
update.vrequests_pending().value_or_empty());
update.vrequests_pending().value_or_empty(),
update.vrecent_requesters().value_or_empty());
chat->session().api().applyNotifySettings(
MTP_inputNotifyPeer(chat->input),