Show bot privacy status

This commit is contained in:
RadRussianRus 2020-04-30 18:31:44 +03:00 committed by John Preston
parent 95b4f56b86
commit ca49e74b6f
5 changed files with 20 additions and 2 deletions

View File

@ -130,7 +130,7 @@ public:
LastSeen,
Custom,
};
void refreshStatus();
virtual void refreshStatus();
crl::time refreshStatusTime() const;
void setAbsoluteIndex(int index) {

View File

@ -1786,6 +1786,12 @@ std::unique_ptr<PeerListRow> 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;
}

View File

@ -109,7 +109,7 @@ public:
bool actionSelected) override;
private:
void refreshStatus();
void refreshStatus() override;
static Type ComputeType(not_null<const HistoryItem*> item);
std::vector<not_null<HistoryItem*>> _items;

View File

@ -93,6 +93,17 @@ void MemberListRow::paintNameIcon(
icon->paint(p, x, y, outerWidth);
}
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<PeerListController> CreateMembersController(
not_null<Window::SessionNavigation*> navigation,
not_null<PeerData*> peer) {

View File

@ -46,6 +46,7 @@ public:
int y,
int outerWidth,
bool selected) override;
void refreshStatus() override;
not_null<UserData*> user() const;
bool canRemove() const {