diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 56af4bf246..dc1c436f0c 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -920,8 +920,12 @@ void Controller::fillManageSection() { AddButtonWithCount( _controls.buttonsLayout, tr::lng_manage_peer_permissions(), - Info::Profile::RestrictionsCountValue(_peer) - | ToPositiveNumberStringRestrictions(), + Info::Profile::MigratedOrMeValue( + _peer + ) | rpl::map( + Info::Profile::RestrictionsCountValue + ) | rpl::flatten_latest( + ) | ToPositiveNumberStringRestrictions(), [=] { ShowEditPermissions(_peer); }, st::infoIconPermissions); } @@ -929,8 +933,12 @@ void Controller::fillManageSection() { AddButtonWithCount( _controls.buttonsLayout, tr::lng_manage_peer_administrators(), - Info::Profile::AdminsCountValue(_peer) - | ToPositiveNumberString(), + Info::Profile::MigratedOrMeValue( + _peer + ) | rpl::map( + Info::Profile::AdminsCountValue + ) | rpl::flatten_latest( + ) | ToPositiveNumberString(), [=] { ParticipantsBoxController::Start( navigation, @@ -943,8 +951,12 @@ void Controller::fillManageSection() { AddButtonWithCount( _controls.buttonsLayout, tr::lng_manage_peer_members(), - Info::Profile::MembersCountValue(_peer) - | ToPositiveNumberString(), + Info::Profile::MigratedOrMeValue( + _peer + ) | rpl::map( + Info::Profile::MembersCountValue + ) | rpl::flatten_latest( + ) | ToPositiveNumberString(), [=] { ParticipantsBoxController::Start( navigation, diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.cpp b/Telegram/SourceFiles/info/profile/info_profile_values.cpp index 2d6cc9c41d..a158004c9d 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -276,6 +276,21 @@ rpl::producer RestrictionsCountValue(not_null peer) { Unexpected("User in RestrictionsCountValue()."); } +rpl::producer> MigratedOrMeValue( + not_null peer) { + using Flag = Notify::PeerUpdate::Flag; + if (const auto chat = peer->asChat()) { + return Notify::PeerUpdateValue( + chat, + Flag::MigrationChanged + ) | rpl::map([=] { + return chat->migrateToOrMe(); + }); + } else { + return rpl::single(peer); + } +} + rpl::producer RestrictedCountValue(not_null channel) { using Flag = Notify::PeerUpdate::Flag; return Notify::PeerUpdateValue( diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.h b/Telegram/SourceFiles/info/profile/info_profile_values.h index 0e19d17c3a..39bd89d830 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.h +++ b/Telegram/SourceFiles/info/profile/info_profile_values.h @@ -32,6 +32,9 @@ inline auto ToSingleLine() { }); } +rpl::producer> MigratedOrMeValue( + not_null peer); + rpl::producer NameValue(not_null peer); rpl::producer PhoneValue(not_null user); rpl::producer PhoneOrHiddenValue(not_null user);