Delegated display of DeleteLinkBox to caller.

This commit is contained in:
23rd 2022-03-06 08:28:21 +03:00
parent 5ddb9f9097
commit b18d665fbe
3 changed files with 9 additions and 10 deletions

View File

@ -357,7 +357,9 @@ void Controller::addHeaderBlock(not_null<Ui::VerticalLayout*> container) {
EditLink(_peer, _data.current()); EditLink(_peer, _data.current());
}); });
const auto deleteLink = crl::guard(weak, [=] { const auto deleteLink = crl::guard(weak, [=] {
DeleteLink(_peer, admin, link); delegate()->peerListShowBox(
DeleteLinkBox(_peer, admin, link),
Ui::LayerOption::KeepOther);
}); });
const auto createMenu = [=] { const auto createMenu = [=] {
@ -1276,7 +1278,7 @@ void RevokeLink(
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void DeleteLink( object_ptr<Ui::BoxContent> DeleteLinkBox(
not_null<PeerData*> peer, not_null<PeerData*> peer,
not_null<UserData*> admin, not_null<UserData*> admin,
const QString &link) { const QString &link) {
@ -1287,12 +1289,7 @@ void DeleteLink(
link, link,
std::move(close)); std::move(close));
}; };
Ui::show( return Ui::MakeConfirmBox({ tr::lng_group_invite_delete_sure(), sure });
Ui::MakeConfirmBox({
tr::lng_group_invite_delete_sure(),
sure
}),
Ui::LayerOption::KeepOther);
} }
object_ptr<Ui::BoxContent> ShowInviteLinkBox( object_ptr<Ui::BoxContent> ShowInviteLinkBox(

View File

@ -44,7 +44,7 @@ void RevokeLink(
void EditLink( void EditLink(
not_null<PeerData*> peer, not_null<PeerData*> peer,
const Api::InviteLink &data); const Api::InviteLink &data);
void DeleteLink( [[nodiscard]] object_ptr<Ui::BoxContent> DeleteLinkBox(
not_null<PeerData*> peer, not_null<PeerData*> peer,
not_null<UserData*> admin, not_null<UserData*> admin,
const QString &link); const QString &link);

View File

@ -579,7 +579,9 @@ base::unique_qptr<Ui::PopupMenu> LinksController::createRowContextMenu(
st::popupMenuWithIcons); st::popupMenuWithIcons);
if (data.revoked) { if (data.revoked) {
result->addAction(tr::lng_group_invite_context_delete(tr::now), [=] { result->addAction(tr::lng_group_invite_context_delete(tr::now), [=] {
DeleteLink(_peer, _admin, link); delegate()->peerListShowBox(
DeleteLinkBox(_peer, _admin, link),
Ui::LayerOption::KeepOther);
}, &st::menuIconDelete); }, &st::menuIconDelete);
} else { } else {
result->addAction(tr::lng_group_invite_context_copy(tr::now), [=] { result->addAction(tr::lng_group_invite_context_copy(tr::now), [=] {