2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Display admin badges in supergroups.

Also prefer std containers to Qt and OrderedSet in data_peer.
This commit is contained in:
John Preston
2017-12-01 22:38:44 +04:00
parent 3bdce06e19
commit 85b3d3f64d
27 changed files with 347 additions and 220 deletions

View File

@@ -153,9 +153,9 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
} else if (_type == Type::Mentions) {
int maxListSize = _addInlineBots ? cRecentInlineBots().size() : 0;
if (_chat) {
maxListSize += (_chat->participants.isEmpty() ? _chat->lastAuthors.size() : _chat->participants.size());
maxListSize += (_chat->participants.empty() ? _chat->lastAuthors.size() : _chat->participants.size());
} else if (_channel && _channel->isMegagroup()) {
if (_channel->mgInfo->lastParticipants.isEmpty() || _channel->lastParticipantsCountOutdated()) {
if (_channel->mgInfo->lastParticipants.empty() || _channel->lastParticipantsCountOutdated()) {
} else {
maxListSize += _channel->mgInfo->lastParticipants.size();
}
@@ -192,19 +192,18 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
}
if (_chat) {
QMultiMap<int32, UserData*> ordered;
mrows.reserve(mrows.size() + (_chat->participants.isEmpty() ? _chat->lastAuthors.size() : _chat->participants.size()));
mrows.reserve(mrows.size() + (_chat->participants.empty() ? _chat->lastAuthors.size() : _chat->participants.size()));
if (_chat->noParticipantInfo()) {
Auth().api().requestFullPeer(_chat);
} else if (!_chat->participants.isEmpty()) {
for (auto i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) {
auto user = i.key();
} else if (!_chat->participants.empty()) {
for (const auto [user, v] : _chat->participants) {
if (user->isInaccessible()) continue;
if (!listAllSuggestions && filterNotPassedByName(user)) continue;
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
ordered.insertMulti(App::onlineForSort(user, now), user);
}
}
for_const (auto user, _chat->lastAuthors) {
for (const auto user : _chat->lastAuthors) {
if (user->isInaccessible()) continue;
if (!listAllSuggestions && filterNotPassedByName(user)) continue;
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
@@ -221,11 +220,11 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
}
} else if (_channel && _channel->isMegagroup()) {
QMultiMap<int32, UserData*> ordered;
if (_channel->mgInfo->lastParticipants.isEmpty() || _channel->lastParticipantsCountOutdated()) {
if (_channel->mgInfo->lastParticipants.empty() || _channel->lastParticipantsCountOutdated()) {
Auth().api().requestLastParticipants(_channel);
} else {
mrows.reserve(mrows.size() + _channel->mgInfo->lastParticipants.size());
for_const (auto user, _channel->mgInfo->lastParticipants) {
for (const auto user : _channel->mgInfo->lastParticipants) {
if (user->isInaccessible()) continue;
if (!listAllSuggestions && filterNotPassedByName(user)) continue;
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
@@ -251,9 +250,8 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
if (_chat) {
if (_chat->noParticipantInfo()) {
Auth().api().requestFullPeer(_chat);
} else if (!_chat->participants.isEmpty()) {
for (auto i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) {
auto user = i.key();
} else if (!_chat->participants.empty()) {
for (const auto [user, version] : _chat->participants) {
if (!user->botInfo) continue;
if (!user->botInfo->inited) {
Auth().api().requestFullPeer(user);
@@ -270,7 +268,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
cnt = _user->botInfo->commands.size();
bots.insert(_user, true);
} else if (_channel && _channel->isMegagroup()) {
if (_channel->mgInfo->bots.isEmpty()) {
if (_channel->mgInfo->bots.empty()) {
if (!_channel->mgInfo->botStatus) {
Auth().api().requestBots(_channel);
}