Delegated display of RevokeLinkBox to caller.
This commit is contained in:
parent
905a7e6346
commit
dc6788706c
|
@ -351,7 +351,9 @@ void Controller::addHeaderBlock(not_null<Ui::VerticalLayout*> container) {
|
||||||
InviteLinkQrBox(link);
|
InviteLinkQrBox(link);
|
||||||
});
|
});
|
||||||
const auto revokeLink = crl::guard(weak, [=] {
|
const auto revokeLink = crl::guard(weak, [=] {
|
||||||
RevokeLink(_peer, admin, link);
|
delegate()->peerListShowBox(
|
||||||
|
RevokeLinkBox(_peer, admin, link),
|
||||||
|
Ui::LayerOption::KeepOther);
|
||||||
});
|
});
|
||||||
const auto editLink = crl::guard(weak, [=] {
|
const auto editLink = crl::guard(weak, [=] {
|
||||||
delegate()->peerListShowBox(
|
delegate()->peerListShowBox(
|
||||||
|
@ -959,19 +961,11 @@ void AddPermanentLinkBlock(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const auto revokeLink = crl::guard(weak, [=] {
|
const auto revokeLink = crl::guard(weak, [=] {
|
||||||
const auto done = crl::guard(weak, [=](Fn<void()> &&close) {
|
if (const auto current = value->current(); !current.link.isEmpty()) {
|
||||||
peer->session().api().inviteLinks().revokePermanent(
|
show->showBox(
|
||||||
peer,
|
RevokeLinkBox(peer, admin, current.link, true),
|
||||||
admin,
|
Ui::LayerOption::KeepOther);
|
||||||
value->current().link,
|
}
|
||||||
std::move(close));
|
|
||||||
});
|
|
||||||
show->showBox(
|
|
||||||
Ui::MakeConfirmBox({
|
|
||||||
tr::lng_group_invite_about_new(tr::now),
|
|
||||||
done
|
|
||||||
}),
|
|
||||||
Ui::LayerOption::KeepOther);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
auto link = value->value(
|
auto link = value->value(
|
||||||
|
@ -1266,22 +1260,26 @@ object_ptr<Ui::BoxContent> EditLinkBox(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RevokeLink(
|
object_ptr<Ui::BoxContent> RevokeLinkBox(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
not_null<UserData*> admin,
|
not_null<UserData*> admin,
|
||||||
const QString &link) {
|
const QString &link,
|
||||||
|
bool permanent) {
|
||||||
const auto revoke = [=](Fn<void()> &&close) {
|
const auto revoke = [=](Fn<void()> &&close) {
|
||||||
const auto done = [close = std::move(close)](const LinkData &data) {
|
auto &l = peer->session().api().inviteLinks();
|
||||||
close();
|
if (permanent) {
|
||||||
};
|
l.revokePermanent(peer, admin, link, std::move(close));
|
||||||
peer->session().api().inviteLinks().revoke(peer, admin, link, done);
|
} else {
|
||||||
|
auto done = [c = std::move(close)](const LinkData &) { c(); };
|
||||||
|
l.revoke(peer, admin, link, std::move(done));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Ui::show(
|
return Ui::MakeConfirmBox({
|
||||||
Ui::MakeConfirmBox({
|
permanent
|
||||||
tr::lng_group_invite_revoke_about(),
|
? tr::lng_group_invite_about_new()
|
||||||
revoke
|
: tr::lng_group_invite_revoke_about(),
|
||||||
}),
|
revoke
|
||||||
Ui::LayerOption::KeepOther);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Ui::BoxContent> DeleteLinkBox(
|
object_ptr<Ui::BoxContent> DeleteLinkBox(
|
||||||
|
|
|
@ -37,10 +37,11 @@ void AddPermanentLinkBlock(
|
||||||
void CopyInviteLink(const QString &link);
|
void CopyInviteLink(const QString &link);
|
||||||
void ShareInviteLinkBox(not_null<PeerData*> peer, const QString &link);
|
void ShareInviteLinkBox(not_null<PeerData*> peer, const QString &link);
|
||||||
void InviteLinkQrBox(const QString &link);
|
void InviteLinkQrBox(const QString &link);
|
||||||
void RevokeLink(
|
[[nodiscard]] object_ptr<Ui::BoxContent> RevokeLinkBox(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
not_null<UserData*> admin,
|
not_null<UserData*> admin,
|
||||||
const QString &link);
|
const QString &link,
|
||||||
|
bool permanent = false);
|
||||||
[[nodiscard]] object_ptr<Ui::BoxContent> EditLinkBox(
|
[[nodiscard]] object_ptr<Ui::BoxContent> EditLinkBox(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const Api::InviteLink &data);
|
const Api::InviteLink &data);
|
||||||
|
|
|
@ -599,7 +599,9 @@ base::unique_qptr<Ui::PopupMenu> LinksController::createRowContextMenu(
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}, &st::menuIconEdit);
|
}, &st::menuIconEdit);
|
||||||
result->addAction(tr::lng_group_invite_context_revoke(tr::now), [=] {
|
result->addAction(tr::lng_group_invite_context_revoke(tr::now), [=] {
|
||||||
RevokeLink(_peer, _admin, link);
|
delegate()->peerListShowBox(
|
||||||
|
RevokeLinkBox(_peer, _admin, link),
|
||||||
|
Ui::LayerOption::KeepOther);
|
||||||
}, &st::menuIconRemove);
|
}, &st::menuIconRemove);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue