mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Update API scheme on layer 145.
This commit is contained in:
@@ -72,15 +72,14 @@ PossibleItemReactions LookupPossibleReactions(not_null<HistoryItem*> item) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const auto filter = PeerReactionsFilter(peer);
|
||||
result.recent.reserve(filter.allowed
|
||||
? filter.allowed->size()
|
||||
const auto &allowed = PeerAllowedReactions(peer);
|
||||
result.recent.reserve((allowed.type == AllowedReactionsType::Some)
|
||||
? allowed.some.size()
|
||||
: full.size());
|
||||
for (const auto &reaction : full) {
|
||||
const auto id = reaction.id;
|
||||
const auto emoji = filter.allowed ? id.emoji() : QString();
|
||||
if (filter.allowed
|
||||
&& (emoji.isEmpty() || !filter.allowed->contains(emoji))) {
|
||||
if ((allowed.type == AllowedReactionsType::Some)
|
||||
&& !ranges::contains(allowed.some, id)) {
|
||||
continue;
|
||||
} else if (reaction.premium
|
||||
&& !session->premium()
|
||||
@@ -93,7 +92,7 @@ PossibleItemReactions LookupPossibleReactions(not_null<HistoryItem*> item) {
|
||||
result.recent.push_back(&reaction);
|
||||
}
|
||||
}
|
||||
result.customAllowed = session->premium() && peer->isUser();
|
||||
result.customAllowed = (allowed.type == AllowedReactionsType::All);
|
||||
}
|
||||
const auto i = ranges::find(
|
||||
result.recent,
|
||||
@@ -344,19 +343,6 @@ void Reactions::downloadTaskFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
base::flat_set<QString> Reactions::ParseAllowed(
|
||||
const MTPVector<MTPstring> *list) {
|
||||
if (!list) {
|
||||
return {};
|
||||
}
|
||||
const auto parsed = ranges::views::all(
|
||||
list->v
|
||||
) | ranges::views::transform([](const MTPstring &string) {
|
||||
return qs(string);
|
||||
}) | ranges::to_vector;
|
||||
return { begin(parsed), end(parsed) };
|
||||
}
|
||||
|
||||
void Reactions::request() {
|
||||
auto &api = _owner->session().api();
|
||||
if (_requestId) {
|
||||
|
Reference in New Issue
Block a user