mirror of https://github.com/procxx/kepka.git
				
				
				
			Fix manage group box after migration.
This commit is contained in:
		
							parent
							
								
									328b090877
								
							
						
					
					
						commit
						055c145af5
					
				|  | @ -920,8 +920,12 @@ void Controller::fillManageSection() { | ||||||
| 		AddButtonWithCount( | 		AddButtonWithCount( | ||||||
| 			_controls.buttonsLayout, | 			_controls.buttonsLayout, | ||||||
| 			tr::lng_manage_peer_permissions(), | 			tr::lng_manage_peer_permissions(), | ||||||
| 			Info::Profile::RestrictionsCountValue(_peer) | 			Info::Profile::MigratedOrMeValue( | ||||||
| 			| ToPositiveNumberStringRestrictions(), | 				_peer | ||||||
|  | 			) | rpl::map( | ||||||
|  | 				Info::Profile::RestrictionsCountValue | ||||||
|  | 			) | rpl::flatten_latest( | ||||||
|  | 			) | ToPositiveNumberStringRestrictions(), | ||||||
| 			[=] { ShowEditPermissions(_peer); }, | 			[=] { ShowEditPermissions(_peer); }, | ||||||
| 			st::infoIconPermissions); | 			st::infoIconPermissions); | ||||||
| 	} | 	} | ||||||
|  | @ -929,8 +933,12 @@ void Controller::fillManageSection() { | ||||||
| 		AddButtonWithCount( | 		AddButtonWithCount( | ||||||
| 			_controls.buttonsLayout, | 			_controls.buttonsLayout, | ||||||
| 			tr::lng_manage_peer_administrators(), | 			tr::lng_manage_peer_administrators(), | ||||||
| 			Info::Profile::AdminsCountValue(_peer) | 			Info::Profile::MigratedOrMeValue( | ||||||
| 			| ToPositiveNumberString(), | 				_peer | ||||||
|  | 			) | rpl::map( | ||||||
|  | 				Info::Profile::AdminsCountValue | ||||||
|  | 			) | rpl::flatten_latest( | ||||||
|  | 			) | ToPositiveNumberString(), | ||||||
| 			[=] { | 			[=] { | ||||||
| 				ParticipantsBoxController::Start( | 				ParticipantsBoxController::Start( | ||||||
| 					navigation, | 					navigation, | ||||||
|  | @ -943,8 +951,12 @@ void Controller::fillManageSection() { | ||||||
| 		AddButtonWithCount( | 		AddButtonWithCount( | ||||||
| 			_controls.buttonsLayout, | 			_controls.buttonsLayout, | ||||||
| 			tr::lng_manage_peer_members(), | 			tr::lng_manage_peer_members(), | ||||||
| 			Info::Profile::MembersCountValue(_peer) | 			Info::Profile::MigratedOrMeValue( | ||||||
| 			| ToPositiveNumberString(), | 				_peer | ||||||
|  | 			) | rpl::map( | ||||||
|  | 				Info::Profile::MembersCountValue | ||||||
|  | 			) | rpl::flatten_latest( | ||||||
|  | 			) | ToPositiveNumberString(), | ||||||
| 			[=] { | 			[=] { | ||||||
| 				ParticipantsBoxController::Start( | 				ParticipantsBoxController::Start( | ||||||
| 					navigation, | 					navigation, | ||||||
|  |  | ||||||
|  | @ -276,6 +276,21 @@ rpl::producer<int> RestrictionsCountValue(not_null<PeerData*> peer) { | ||||||
| 	Unexpected("User in RestrictionsCountValue()."); | 	Unexpected("User in RestrictionsCountValue()."); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | rpl::producer<not_null<PeerData*>> MigratedOrMeValue( | ||||||
|  | 		not_null<PeerData*> 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<int> RestrictedCountValue(not_null<ChannelData*> channel) { | rpl::producer<int> RestrictedCountValue(not_null<ChannelData*> channel) { | ||||||
| 	using Flag = Notify::PeerUpdate::Flag; | 	using Flag = Notify::PeerUpdate::Flag; | ||||||
| 	return Notify::PeerUpdateValue( | 	return Notify::PeerUpdateValue( | ||||||
|  |  | ||||||
|  | @ -32,6 +32,9 @@ inline auto ToSingleLine() { | ||||||
| 	}); | 	}); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | rpl::producer<not_null<PeerData*>> MigratedOrMeValue( | ||||||
|  | 	not_null<PeerData*> peer); | ||||||
|  | 
 | ||||||
| rpl::producer<TextWithEntities> NameValue(not_null<PeerData*> peer); | rpl::producer<TextWithEntities> NameValue(not_null<PeerData*> peer); | ||||||
| rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user); | rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user); | ||||||
| rpl::producer<TextWithEntities> PhoneOrHiddenValue(not_null<UserData*> user); | rpl::producer<TextWithEntities> PhoneOrHiddenValue(not_null<UserData*> user); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue