mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-01 12:00:48 +00:00
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:
parent
733cad798b
commit
14f937cb02
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user