mirror of https://github.com/procxx/kepka.git
				
				
				
			Allow transfer of legacy groups.
This commit is contained in:
		
							parent
							
								
									b9d1d8519c
								
							
						
					
					
						commit
						3c11eda611
					
				| 
						 | 
					@ -461,6 +461,9 @@ void AddSpecialBoxController::showAdmin(
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_editBox = nullptr;
 | 
						_editBox = nullptr;
 | 
				
			||||||
 | 
						if (_editParticipantBox) {
 | 
				
			||||||
 | 
							_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const auto chat = _peer->asChat();
 | 
						const auto chat = _peer->asChat();
 | 
				
			||||||
	const auto channel = _peer->asChannel();
 | 
						const auto channel = _peer->asChannel();
 | 
				
			||||||
| 
						 | 
					@ -557,17 +560,21 @@ void AddSpecialBoxController::showAdmin(
 | 
				
			||||||
			editAdminDone(user, newRights);
 | 
								editAdminDone(user, newRights);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		const auto fail = crl::guard(this, [=] {
 | 
							const auto fail = crl::guard(this, [=] {
 | 
				
			||||||
			_editBox = nullptr;
 | 
								if (_editParticipantBox) {
 | 
				
			||||||
 | 
									_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail));
 | 
							box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_editBox = Ui::show(std::move(box), LayerOption::KeepOther);
 | 
						_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AddSpecialBoxController::editAdminDone(
 | 
					void AddSpecialBoxController::editAdminDone(
 | 
				
			||||||
		not_null<UserData*> user,
 | 
							not_null<UserData*> user,
 | 
				
			||||||
		const MTPChatAdminRights &rights) {
 | 
							const MTPChatAdminRights &rights) {
 | 
				
			||||||
	_editBox = nullptr;
 | 
						if (_editParticipantBox) {
 | 
				
			||||||
 | 
							_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const auto date = unixtime(); // Incorrect, but ignored.
 | 
						const auto date = unixtime(); // Incorrect, but ignored.
 | 
				
			||||||
	if (rights.c_chatAdminRights().vflags.v == 0) {
 | 
						if (rights.c_chatAdminRights().vflags.v == 0) {
 | 
				
			||||||
| 
						 | 
					@ -598,6 +605,9 @@ void AddSpecialBoxController::showRestricted(
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_editBox = nullptr;
 | 
						_editBox = nullptr;
 | 
				
			||||||
 | 
						if (_editParticipantBox) {
 | 
				
			||||||
 | 
							_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const auto chat = _peer->asChat();
 | 
						const auto chat = _peer->asChat();
 | 
				
			||||||
	const auto channel = _peer->asChannel();
 | 
						const auto channel = _peer->asChannel();
 | 
				
			||||||
| 
						 | 
					@ -646,18 +656,22 @@ void AddSpecialBoxController::showRestricted(
 | 
				
			||||||
			editRestrictedDone(user, newRights);
 | 
								editRestrictedDone(user, newRights);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		const auto fail = crl::guard(this, [=] {
 | 
							const auto fail = crl::guard(this, [=] {
 | 
				
			||||||
			_editBox = nullptr;
 | 
								if (_editParticipantBox) {
 | 
				
			||||||
 | 
									_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		box->setSaveCallback(
 | 
							box->setSaveCallback(
 | 
				
			||||||
			SaveRestrictedCallback(_peer, user, done, fail));
 | 
								SaveRestrictedCallback(_peer, user, done, fail));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_editBox = Ui::show(std::move(box), LayerOption::KeepOther);
 | 
						_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AddSpecialBoxController::editRestrictedDone(
 | 
					void AddSpecialBoxController::editRestrictedDone(
 | 
				
			||||||
		not_null<UserData*> user,
 | 
							not_null<UserData*> user,
 | 
				
			||||||
		const MTPChatBannedRights &rights) {
 | 
							const MTPChatBannedRights &rights) {
 | 
				
			||||||
	_editBox = nullptr;
 | 
						if (_editParticipantBox) {
 | 
				
			||||||
 | 
							_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const auto date = unixtime(); // Incorrect, but ignored.
 | 
						const auto date = unixtime(); // Incorrect, but ignored.
 | 
				
			||||||
	if (rights.c_chatBannedRights().vflags.v == 0) {
 | 
						if (rights.c_chatBannedRights().vflags.v == 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,6 +110,7 @@ private:
 | 
				
			||||||
	ParticipantsAdditionalData _additional;
 | 
						ParticipantsAdditionalData _additional;
 | 
				
			||||||
	std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
 | 
						std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
 | 
				
			||||||
	BoxPointer _editBox;
 | 
						BoxPointer _editBox;
 | 
				
			||||||
 | 
						QPointer<BoxContent> _editParticipantBox;
 | 
				
			||||||
	AdminDoneCallback _adminDoneCallback;
 | 
						AdminDoneCallback _adminDoneCallback;
 | 
				
			||||||
	BannedDoneCallback _bannedDoneCallback;
 | 
						BannedDoneCallback _bannedDoneCallback;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1422,18 +1422,22 @@ void ParticipantsBoxController::showAdmin(not_null<UserData*> user) {
 | 
				
			||||||
			editAdminDone(user, newRights);
 | 
								editAdminDone(user, newRights);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		const auto fail = crl::guard(this, [=] {
 | 
							const auto fail = crl::guard(this, [=] {
 | 
				
			||||||
			_editBox = nullptr;
 | 
								if (_editParticipantBox) {
 | 
				
			||||||
 | 
									_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail));
 | 
							box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_editBox = Ui::show(std::move(box), LayerOption::KeepOther);
 | 
						_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::editAdminDone(
 | 
					void ParticipantsBoxController::editAdminDone(
 | 
				
			||||||
		not_null<UserData*> user,
 | 
							not_null<UserData*> user,
 | 
				
			||||||
		const MTPChatAdminRights &rights) {
 | 
							const MTPChatAdminRights &rights) {
 | 
				
			||||||
	_addBox = nullptr;
 | 
						_addBox = nullptr;
 | 
				
			||||||
	_editBox = nullptr;
 | 
						if (_editParticipantBox) {
 | 
				
			||||||
 | 
							_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const auto date = unixtime(); // Incorrect, but ignored.
 | 
						const auto date = unixtime(); // Incorrect, but ignored.
 | 
				
			||||||
	if (rights.c_chatAdminRights().vflags.v == 0) {
 | 
						if (rights.c_chatAdminRights().vflags.v == 0) {
 | 
				
			||||||
| 
						 | 
					@ -1485,19 +1489,23 @@ void ParticipantsBoxController::showRestricted(not_null<UserData*> user) {
 | 
				
			||||||
			editRestrictedDone(user, newRights);
 | 
								editRestrictedDone(user, newRights);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		const auto fail = crl::guard(this, [=] {
 | 
							const auto fail = crl::guard(this, [=] {
 | 
				
			||||||
			_editBox = nullptr;
 | 
								if (_editParticipantBox) {
 | 
				
			||||||
 | 
									_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		box->setSaveCallback(
 | 
							box->setSaveCallback(
 | 
				
			||||||
			SaveRestrictedCallback(_peer, user, done, fail));
 | 
								SaveRestrictedCallback(_peer, user, done, fail));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_editBox = Ui::show(std::move(box), LayerOption::KeepOther);
 | 
						_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::editRestrictedDone(
 | 
					void ParticipantsBoxController::editRestrictedDone(
 | 
				
			||||||
		not_null<UserData*> user,
 | 
							not_null<UserData*> user,
 | 
				
			||||||
		const MTPChatBannedRights &rights) {
 | 
							const MTPChatBannedRights &rights) {
 | 
				
			||||||
	_addBox = nullptr;
 | 
						_addBox = nullptr;
 | 
				
			||||||
	_editBox = nullptr;
 | 
						if (_editParticipantBox) {
 | 
				
			||||||
 | 
							_editParticipantBox->closeBox();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const auto date = unixtime(); // Incorrect, but ignored.
 | 
						const auto date = unixtime(); // Incorrect, but ignored.
 | 
				
			||||||
	if (rights.c_chatBannedRights().vflags.v == 0) {
 | 
						if (rights.c_chatBannedRights().vflags.v == 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -237,6 +237,7 @@ private:
 | 
				
			||||||
	std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
 | 
						std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
 | 
				
			||||||
	BoxPointer _editBox;
 | 
						BoxPointer _editBox;
 | 
				
			||||||
	BoxPointer _addBox;
 | 
						BoxPointer _addBox;
 | 
				
			||||||
 | 
						QPointer<BoxContent> _editParticipantBox;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue