2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Show emoji statuses in channels.

This commit is contained in:
John Preston
2023-12-16 22:43:35 +00:00
parent 6aaf841a73
commit 805a5d73b6
12 changed files with 81 additions and 67 deletions

View File

@@ -98,16 +98,15 @@ namespace {
[[nodiscard]] rpl::producer<TextWithEntities> PeerCustomStatus(
not_null<PeerData*> peer) {
const auto user = peer->asUser();
if (!user) {
if (peer->isChat()) {
return rpl::single(TextWithEntities());
}
const auto owner = &user->owner();
return user->session().changes().peerFlagsValue(
user,
const auto owner = &peer->owner();
return peer->session().changes().peerFlagsValue(
peer,
Data::PeerUpdate::Flag::EmojiStatus
) | rpl::map([=] {
const auto id = user->emojiStatusId();
const auto id = peer->emojiStatusId();
return id
? ResolveIsCustom(owner, id)
: rpl::single(TextWithEntities());

View File

@@ -1410,13 +1410,12 @@ void Message::paintFromName(
const auto y = trect.top();
auto color = nameFg;
color.setAlpha(115);
const auto user = from->asUser();
const auto id = user ? user->emojiStatusId() : 0;
const auto id = from ? from->emojiStatusId() : 0;
if (_fromNameStatus->id != id) {
const auto that = const_cast<Message*>(this);
_fromNameStatus->custom = id
? std::make_unique<Ui::Text::LimitedLoopsEmoji>(
user->owner().customEmojiManager().create(
history()->owner().customEmojiManager().create(
id,
[=] { that->customEmojiRepaint(); }),
kPlayStatusLimit)
@@ -3017,7 +3016,8 @@ void Message::validateFromNameText(PeerData *from) const {
from->name(),
Ui::NameTextOptions());
}
if (from->isPremium()) {
if (from->isPremium()
|| (from->isChannel() && from != history()->peer)) {
if (!_fromNameStatus) {
_fromNameStatus = std::make_unique<FromNameStatus>();
const auto size = st::emojiSize;