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:
@@ -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),
|
||||
|
Reference in New Issue
Block a user