Show only some reactions in the bottom info.

Only in private chats with no premium users.
Only if nobody sent more than one reaction while was premium.
Only if nobody sent a custom emoji reaction while was premium.
This commit is contained in:
John Preston 2022-08-26 10:13:42 +04:00
parent 733cad798b
commit 14f937cb02
1 changed files with 28 additions and 1 deletions

View File

@ -2167,7 +2167,34 @@ bool Message::isSignedAuthorElided() const {
}
bool Message::embedReactionsInBottomInfo() const {
return data()->history()->peer->isUser();
const auto item = data();
const auto user = item->history()->peer->asUser();
if (!user || user->isPremium() || user->session().premium()) {
// Only in messages of a non premium user with a non premium user.
return false;
}
auto seenMy = false;
auto seenHis = false;
for (const auto &reaction : item->reactions()) {
if (reaction.id.custom()) {
// Only in messages without any custom emoji reactions.
return false;
}
// Only in messages without two reactions from the same person.
if (reaction.my) {
if (seenMy) {
return false;
}
seenMy = true;
}
if (!reaction.my || (reaction.count > 1)) {
if (seenHis) {
return false;
}
seenHis = true;
}
}
return true;
}
bool Message::embedReactionsInBubble() const {