2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Support custom emoji reactions in WhoReacted.

This commit is contained in:
John Preston
2022-08-26 23:53:48 +04:00
parent ba83836922
commit 668a3308be
22 changed files with 538 additions and 246 deletions

View File

@@ -72,7 +72,6 @@ constexpr auto kTopReactionsLimit = 10;
.centerIcon = document,
.active = true,
};
}
} // namespace
@@ -99,16 +98,13 @@ PossibleItemReactionsRef LookupPossibleReactions(
return true; // #TODO reactions
}();
auto added = base::flat_set<ReactionId>();
const auto addOne = [&](const Reaction &reaction) {
if (added.emplace(reaction.id).second) {
result.recent.push_back(&reaction);
}
};
const auto add = [&](auto predicate) {
auto &&all = ranges::views::concat(top, recent, full);
auto &&all = ranges::views::concat(recent, top, full);
for (const auto &reaction : all) {
if (predicate(reaction)) {
addOne(reaction);
if (added.emplace(reaction.id).second) {
result.recent.push_back(&reaction);
}
}
}
};