diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp index d5ad67c9f..a6d05e4aa 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp @@ -461,6 +461,9 @@ void AddSpecialBoxController::showAdmin( return; } _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } const auto chat = _peer->asChat(); const auto channel = _peer->asChannel(); @@ -557,17 +560,21 @@ void AddSpecialBoxController::showAdmin( editAdminDone(user, newRights); }); const auto fail = crl::guard(this, [=] { - _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } }); 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( not_null user, const MTPChatAdminRights &rights) { - _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } const auto date = unixtime(); // Incorrect, but ignored. if (rights.c_chatAdminRights().vflags.v == 0) { @@ -598,6 +605,9 @@ void AddSpecialBoxController::showRestricted( return; } _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } const auto chat = _peer->asChat(); const auto channel = _peer->asChannel(); @@ -646,18 +656,22 @@ void AddSpecialBoxController::showRestricted( editRestrictedDone(user, newRights); }); const auto fail = crl::guard(this, [=] { - _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } }); box->setSaveCallback( SaveRestrictedCallback(_peer, user, done, fail)); } - _editBox = Ui::show(std::move(box), LayerOption::KeepOther); + _editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther); } void AddSpecialBoxController::editRestrictedDone( not_null user, const MTPChatBannedRights &rights) { - _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } const auto date = unixtime(); // Incorrect, but ignored. if (rights.c_chatBannedRights().vflags.v == 0) { diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.h b/Telegram/SourceFiles/boxes/peers/add_participants_box.h index 2fed9092e..cc45a60eb 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.h +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.h @@ -110,6 +110,7 @@ private: ParticipantsAdditionalData _additional; std::unique_ptr _onlineSorter; BoxPointer _editBox; + QPointer _editParticipantBox; AdminDoneCallback _adminDoneCallback; BannedDoneCallback _bannedDoneCallback; diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index a158fed5f..508dc5ba2 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -1422,18 +1422,22 @@ void ParticipantsBoxController::showAdmin(not_null user) { editAdminDone(user, newRights); }); const auto fail = crl::guard(this, [=] { - _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } }); 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( not_null user, const MTPChatAdminRights &rights) { _addBox = nullptr; - _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } const auto date = unixtime(); // Incorrect, but ignored. if (rights.c_chatAdminRights().vflags.v == 0) { @@ -1485,19 +1489,23 @@ void ParticipantsBoxController::showRestricted(not_null user) { editRestrictedDone(user, newRights); }); const auto fail = crl::guard(this, [=] { - _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } }); box->setSaveCallback( SaveRestrictedCallback(_peer, user, done, fail)); } - _editBox = Ui::show(std::move(box), LayerOption::KeepOther); + _editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther); } void ParticipantsBoxController::editRestrictedDone( not_null user, const MTPChatBannedRights &rights) { _addBox = nullptr; - _editBox = nullptr; + if (_editParticipantBox) { + _editParticipantBox->closeBox(); + } const auto date = unixtime(); // Incorrect, but ignored. if (rights.c_chatBannedRights().vflags.v == 0) { diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.h b/Telegram/SourceFiles/boxes/peers/edit_participants_box.h index 6ba83770a..a58cae39b 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.h +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.h @@ -237,6 +237,7 @@ private: std::unique_ptr _onlineSorter; BoxPointer _editBox; BoxPointer _addBox; + QPointer _editParticipantBox; };