mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 15:17:07 +02:00
Suggest group-with-hidden-members admins in mentions.
This commit is contained in:
parent
027e662478
commit
d52475666d
5 changed files with 28 additions and 6 deletions
Telegram/SourceFiles
api
boxes/peers
chat_helpers
data
history
|
@ -439,6 +439,7 @@ void ChatParticipants::requestAdmins(not_null<ChannelData*> channel) {
|
|||
MTP_int(channel->session().serverConfig().chatSizeMax),
|
||||
MTP_long(participantsHash)
|
||||
)).done([=](const MTPchannels_ChannelParticipants &result) {
|
||||
channel->mgInfo->adminsLoaded = true;
|
||||
_adminsRequests.remove(channel);
|
||||
result.match([&](const MTPDchannels_channelParticipants &data) {
|
||||
channel->owner().processUsers(data.vusers());
|
||||
|
@ -448,6 +449,7 @@ void ChatParticipants::requestAdmins(not_null<ChannelData*> channel) {
|
|||
"channels.channelParticipantsNotModified received!"));
|
||||
});
|
||||
}).fail([=] {
|
||||
channel->mgInfo->adminsLoaded = true;
|
||||
_adminsRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
|
|
@ -1505,6 +1505,11 @@ void ParticipantsBoxController::loadMoreRows() {
|
|||
LOG(("API Error: "
|
||||
"channels.channelParticipantsNotModified received!"));
|
||||
});
|
||||
if (_offset > 0 && _role == Role::Admins && channel->isMegagroup()) {
|
||||
if (channel->mgInfo->admins.empty() && channel->mgInfo->adminsLoaded) {
|
||||
channel->mgInfo->adminsLoaded = false;
|
||||
}
|
||||
}
|
||||
if (!firstLoad && !added) {
|
||||
_allLoaded = true;
|
||||
}
|
||||
|
|
|
@ -422,7 +422,9 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
if (_chat) {
|
||||
maxListSize += (_chat->participants.empty() ? _chat->lastAuthors.size() : _chat->participants.size());
|
||||
} else if (_channel && _channel->isMegagroup()) {
|
||||
if (!_channel->lastParticipantsRequestNeeded()) {
|
||||
if (!_channel->canViewMembers()) {
|
||||
maxListSize += _channel->mgInfo->admins.size();
|
||||
} else if (!_channel->lastParticipantsRequestNeeded()) {
|
||||
maxListSize += _channel->mgInfo->lastParticipants.size();
|
||||
}
|
||||
}
|
||||
|
@ -488,10 +490,22 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
--i;
|
||||
mrows.push_back({ i->second });
|
||||
}
|
||||
} else if (_channel
|
||||
&& _channel->isMegagroup()
|
||||
&& _channel->canViewMembers()) {
|
||||
if (_channel->lastParticipantsRequestNeeded()) {
|
||||
} else if (_channel && _channel->isMegagroup()) {
|
||||
if (!_channel->canViewMembers()) {
|
||||
if (!_channel->mgInfo->adminsLoaded) {
|
||||
_channel->session().api().chatParticipants().requestAdmins(_channel);
|
||||
} else {
|
||||
mrows.reserve(mrows.size() + _channel->mgInfo->admins.size());
|
||||
for (const auto [userId, rank] : _channel->mgInfo->admins) {
|
||||
if (const auto user = _channel->owner().userLoaded(userId)) {
|
||||
if (user->isInaccessible()) continue;
|
||||
if (!listAllSuggestions && filterNotPassedByName(user)) continue;
|
||||
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
|
||||
mrows.push_back({ user });
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (_channel->lastParticipantsRequestNeeded()) {
|
||||
_channel->session().api().chatParticipants().requestLast(
|
||||
_channel);
|
||||
} else {
|
||||
|
|
|
@ -116,6 +116,7 @@ public:
|
|||
QString creatorRank;
|
||||
int botStatus = 0; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other
|
||||
bool joinedMessageFound = false;
|
||||
bool adminsLoaded = false;
|
||||
StickerSetIdentifier stickerSet;
|
||||
|
||||
enum LastParticipantsStatus {
|
||||
|
|
|
@ -7495,7 +7495,7 @@ void HistoryWidget::handlePeerUpdate() {
|
|||
if (!channel->mgInfo->botStatus) {
|
||||
session().api().chatParticipants().requestBots(channel);
|
||||
}
|
||||
if (channel->mgInfo->admins.empty()) {
|
||||
if (!channel->mgInfo->adminsLoaded) {
|
||||
session().api().chatParticipants().requestAdmins(channel);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue