Attempted to fix change color in preview while reset unique status.

This commit is contained in:
23rd
2025-11-15 14:40:40 +03:00
committed by John Preston
parent a9cf5dd6f2
commit 55ae81524d
2 changed files with 6 additions and 4 deletions
@@ -2214,15 +2214,15 @@ void EditPeerProfileColorSection(
const auto setIndex = [=](uint8 index) {
state->index = index;
if (index != kUnsetColorIndex) {
resetUnique();
}
preview->setColorProfileIndex(index == kUnsetColorIndex
? std::nullopt
: std::make_optional(index));
preview->setPatternEmojiId(index == kUnsetColorIndex
? std::nullopt
: std::make_optional(state->patternEmojiId.current()));
if (index != kUnsetColorIndex) {
resetUnique();
}
};
setIndex(peer->colorProfileIndex().value_or(kUnsetColorIndex));
@@ -1250,7 +1250,7 @@ void TopBar::setPatternEmojiId(std::optional<DocumentId> patternEmojiId) {
void TopBar::setLocalEmojiStatusId(EmojiStatusId emojiStatusId) {
_localCollectible = emojiStatusId.collectible;
if (emojiStatusId) {
if (!emojiStatusId.collectible) {
_badgeContent = Badge::Content{ BadgeType::Premium, emojiStatusId };
} else {
_badgeContent = BadgeContentForPeer(_peer);
@@ -1271,6 +1271,8 @@ auto TopBar::effectiveCollectible() const
-> std::shared_ptr<Data::EmojiStatusCollectible> {
return _localCollectible
? _localCollectible
: _localColorProfileIndex
? nullptr
: _peer->emojiStatusId().collectible;
}