Show bot privacy status
This commit is contained in:
		
							parent
							
								
									95b4f56b86
								
							
						
					
					
						commit
						ca49e74b6f
					
				
					 5 changed files with 20 additions and 2 deletions
				
			
		|  | @ -130,7 +130,7 @@ public: | ||||||
| 		LastSeen, | 		LastSeen, | ||||||
| 		Custom, | 		Custom, | ||||||
| 	}; | 	}; | ||||||
| 	void refreshStatus(); | 	virtual void refreshStatus(); | ||||||
| 	crl::time refreshStatusTime() const; | 	crl::time refreshStatusTime() const; | ||||||
| 
 | 
 | ||||||
| 	void setAbsoluteIndex(int index) { | 	void setAbsoluteIndex(int index) { | ||||||
|  |  | ||||||
|  | @ -1786,6 +1786,12 @@ std::unique_ptr<PeerListRow> ParticipantsBoxController::createRow( | ||||||
| 				|| _additional.canEditAdmin(user))) { | 				|| _additional.canEditAdmin(user))) { | ||||||
| 			row->setActionLink(tr::lng_profile_kick(tr::now)); | 			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; | 	return row; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -109,7 +109,7 @@ public: | ||||||
| 		bool actionSelected) override; | 		bool actionSelected) override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
| 	void refreshStatus(); | 	void refreshStatus() override; | ||||||
| 	static Type ComputeType(not_null<const HistoryItem*> item); | 	static Type ComputeType(not_null<const HistoryItem*> item); | ||||||
| 
 | 
 | ||||||
| 	std::vector<not_null<HistoryItem*>> _items; | 	std::vector<not_null<HistoryItem*>> _items; | ||||||
|  |  | ||||||
|  | @ -93,6 +93,17 @@ void MemberListRow::paintNameIcon( | ||||||
| 	icon->paint(p, x, y, outerWidth); | 	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( | std::unique_ptr<PeerListController> CreateMembersController( | ||||||
| 		not_null<Window::SessionNavigation*> navigation, | 		not_null<Window::SessionNavigation*> navigation, | ||||||
| 		not_null<PeerData*> peer) { | 		not_null<PeerData*> peer) { | ||||||
|  |  | ||||||
|  | @ -46,6 +46,7 @@ public: | ||||||
| 		int y, | 		int y, | ||||||
| 		int outerWidth, | 		int outerWidth, | ||||||
| 		bool selected) override; | 		bool selected) override; | ||||||
|  | 	void refreshStatus() override; | ||||||
| 
 | 
 | ||||||
| 	not_null<UserData*> user() const; | 	not_null<UserData*> user() const; | ||||||
| 	bool canRemove() const { | 	bool canRemove() const { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 John Preston
							John Preston