From 18085bae701beeb2662a54d397c90cd63002b469 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 20 Sep 2025 17:49:38 +0300 Subject: [PATCH] Hid unused properties from profile cover in edit contact box. --- .../info/profile/info_profile_cover.cpp | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp index 96b0b3320e..bf9e8427c8 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp @@ -613,8 +613,9 @@ Cover::Cover( , _emojiStatusPanel(peer->isSelf() ? std::make_unique() : nullptr) -, _botVerify( - std::make_unique( +, _botVerify(role == Role::EditContact + ? nullptr + : std::make_unique( this, st::infoBotVerifyBadge, &peer->session(), @@ -660,6 +661,7 @@ Cover::Cover( _st.photo, _peer->userpicShape())) , _changePersonal((role == Role::Info + || role == Role::EditContact || topic || !_peer->isUser() || _peer->isSelf() @@ -670,7 +672,7 @@ Cover::Cover( ? object_ptr(this, controller, topic) : nullptr) , _name(this, _st.name) -, _starsRating(_peer->isUser() +, _starsRating(_peer->isUser() && _role != Role::EditContact ? std::make_unique( this, _controller->uiShow(), @@ -711,18 +713,24 @@ Cover::Cover( ::Settings::ShowEmojiStatusPremium(_controller, _peer); } }); - rpl::merge( - _botVerify->updated(), + auto badgeUpdates = rpl::merge( _badge->updated(), - _verified->updated() - ) | rpl::start_with_next([=] { + _verified->updated()); + if (_botVerify) { + badgeUpdates = rpl::merge( + std::move(badgeUpdates), + _botVerify->updated()); + } + std::move(badgeUpdates) | rpl::start_with_next([=] { refreshNameGeometry(width()); }, _name->lifetime()); initViewers(std::move(title)); setupChildGeometry(); setupUniqueBadgeTooltip(); - setupSavedMusic(); + if (_role != Role::EditContact) { + setupSavedMusic(); + } if (_userpic) { } else if (topic->canEdit()) { @@ -1116,12 +1124,14 @@ void Cover::refreshNameGeometry(int newWidth) { const auto badgeBottom = _st.nameTop + _name->height(); const auto margins = LargeCustomEmojiMargins(); - _botVerify->move(nameLeft - margins.left(), badgeTop, badgeBottom); - if (const auto widget = _botVerify->widget()) { - const auto skip = widget->width() - + st::infoVerifiedCheckPosition.x(); - nameLeft += skip; - nameWidth -= skip; + if (_botVerify) { + _botVerify->move(nameLeft - margins.left(), badgeTop, badgeBottom); + if (const auto widget = _botVerify->widget()) { + const auto skip = widget->width() + + st::infoVerifiedCheckPosition.x(); + nameLeft += skip; + nameWidth -= skip; + } } _name->resizeToNaturalWidth(nameWidth); _name->moveToLeft(nameLeft, _st.nameTop, newWidth);