diff --git a/Telegram/SourceFiles/history/view/history_view_reactions.cpp b/Telegram/SourceFiles/history/view/history_view_reactions.cpp index c8c5d788a..90bce941a 100644 --- a/Telegram/SourceFiles/history/view/history_view_reactions.cpp +++ b/Telegram/SourceFiles/history/view/history_view_reactions.cpp @@ -70,7 +70,16 @@ void InlineList::layoutButtons() { ) | ranges::view::transform([](const auto &pair) { return std::make_pair(pair.first, pair.second); }) | ranges::to_vector; - ranges::sort(sorted, std::greater<>(), &std::pair::second); + const auto &list = _owner->list(::Data::Reactions::Type::All); + ranges::sort(sorted, [&](const auto &p1, const auto &p2) { + if (p1.second > p2.second) { + return true; + } else if (p1.second < p2.second) { + return false; + } + return ranges::find(list, p1.first, &::Data::Reaction::emoji) + < ranges::find(list, p2.first, &::Data::Reaction::emoji); + }); auto buttons = std::vector