From 64266cd7f52acc0fb5bebf6a65976a5af9c513bc Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sun, 8 Mar 2020 01:32:29 +0300 Subject: [PATCH] Bot privacy status in members list --- Telegram/SourceFiles/boxes/peer_list_box.h | 2 +- .../SourceFiles/boxes/peers/edit_participants_box.cpp | 6 ++++++ .../info/profile/info_profile_members_controllers.cpp | 11 +++++++++++ .../info/profile/info_profile_members_controllers.h | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/boxes/peer_list_box.h b/Telegram/SourceFiles/boxes/peer_list_box.h index eb99522dd..8903aefd0 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.h +++ b/Telegram/SourceFiles/boxes/peer_list_box.h @@ -121,7 +121,7 @@ public: LastSeen, Custom, }; - void refreshStatus(); + virtual void refreshStatus(); crl::time refreshStatusTime() const; void setAbsoluteIndex(int index) { diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index afe9af512..77665b540 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -1797,6 +1797,12 @@ std::unique_ptr ParticipantsBoxController::createRow( || _additional.canEditAdmin(user))) { row->setActionLink(tr::lng_profile_kick(tr::now)); } + if (_role == Role::Members && user->isBot()) { + auto seesAllMessages = (user->botInfo->readsAllHistory || _additional.adminRights(user).has_value()); + row->setCustomStatus(seesAllMessages + ? tr::lng_status_bot_reads_all(tr::now) + : tr::lng_status_bot_not_reads_all(tr::now)); + } } return row; } diff --git a/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp b/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp index ef3c38654..ef5dc2234 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp @@ -85,6 +85,17 @@ void MemberListRow::paintAdminRank( p.drawTextLeft(x, y, outerWidth, _type.adminRank, adminRankWidth()); } +void MemberListRow::refreshStatus() { + if (user()->isBot()) { + auto seesAllMessages = (user()->botInfo->readsAllHistory || _type.rights != Rights::Normal); + setCustomStatus(seesAllMessages + ? tr::lng_status_bot_reads_all(tr::now) + : tr::lng_status_bot_not_reads_all(tr::now)); + } else { + PeerListRow::refreshStatus(); + } +} + std::unique_ptr CreateMembersController( not_null navigation, not_null peer) { diff --git a/Telegram/SourceFiles/info/profile/info_profile_members_controllers.h b/Telegram/SourceFiles/info/profile/info_profile_members_controllers.h index 2db859794..0aa2f011d 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_members_controllers.h +++ b/Telegram/SourceFiles/info/profile/info_profile_members_controllers.h @@ -47,6 +47,7 @@ public: int y, int outerWidth, bool selected) override; + void refreshStatus() override; not_null user() const; bool canRemove() const {