mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Push recent requests from requests box to the bar.
This commit is contained in:
@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/peers/edit_participants_box.h" // SubscribeToMigration
|
||||
#include "boxes/peers/edit_peer_invite_link.h" // PrepareRequestedRowStatus
|
||||
#include "history/view/history_view_requests_bar.h" // kRecentRequestsLimit
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_chat.h"
|
||||
@@ -382,6 +383,7 @@ void RequestsBoxController::processRequest(
|
||||
Ui::Text::WithEntities)
|
||||
});
|
||||
}
|
||||
pushRecentRequests();
|
||||
});
|
||||
const auto fail = [] {};
|
||||
session().api().inviteLinks().processRequest(
|
||||
@@ -393,6 +395,24 @@ void RequestsBoxController::processRequest(
|
||||
fail);
|
||||
}
|
||||
|
||||
void RequestsBoxController::pushRecentRequests() {
|
||||
const auto count = std::min(
|
||||
delegate()->peerListFullRowsCount(),
|
||||
HistoryView::kRecentRequestsLimit);
|
||||
if (!count) {
|
||||
return;
|
||||
}
|
||||
auto requests = std::vector<not_null<UserData*>>();
|
||||
requests.reserve(count);
|
||||
for (auto i = 0; i != count; ++i) {
|
||||
requests.push_back(delegate()->peerListRowAt(i)->peer()->asUser());
|
||||
}
|
||||
session().api().inviteLinks().pushRecentRequests({
|
||||
.peer = _peer,
|
||||
.users = std::move(requests),
|
||||
});
|
||||
}
|
||||
|
||||
void RequestsBoxController::appendRow(
|
||||
not_null<UserData*> user,
|
||||
TimeId date) {
|
||||
|
@@ -58,6 +58,7 @@ private:
|
||||
void appendRow(not_null<UserData*> user, TimeId date);
|
||||
void refreshDescription();
|
||||
void processRequest(not_null<UserData*> user, bool approved);
|
||||
void pushRecentRequests();
|
||||
|
||||
void subscribeToMigration();
|
||||
void migrate(not_null<ChatData*> chat, not_null<ChannelData*> channel);
|
||||
|
Reference in New Issue
Block a user