2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Show invite links list with context menu.

This commit is contained in:
John Preston
2021-01-18 20:13:58 +04:00
parent 40e90af76d
commit 01ecf0ca93
10 changed files with 600 additions and 54 deletions

View File

@@ -218,6 +218,12 @@ void InviteLinks::revoke(
performEdit(peer, link, std::move(done), true);
}
void InviteLinks::revokePermanent(
not_null<PeerData*> peer,
Fn<void(Link)> done) {
performCreate(peer, std::move(done), true);
}
void InviteLinks::requestLinks(not_null<PeerData*> peer) {
if (_firstSliceRequests.contains(peer)) {
return;
@@ -411,6 +417,7 @@ auto InviteLinks::parse(
.link = qs(data.vlink()),
.admin = peer->session().data().user(data.vadmin_id().v),
.date = data.vdate().v,
.startDate = data.vstart_date().value_or_empty(),
.expireDate = data.vexpire_date().value_or_empty(),
.usageLimit = data.vusage_limit().value_or_empty(),
.usage = data.vusage().value_or_empty(),

View File

@@ -14,7 +14,8 @@ namespace Api {
struct InviteLink {
QString link;
not_null<UserData*> admin;
TimeId date;
TimeId date = 0;
TimeId startDate = 0;
TimeId expireDate = 0;
int usageLimit = 0;
int usage = 0;
@@ -60,6 +61,9 @@ public:
not_null<PeerData*> peer,
const QString &link,
Fn<void(Link)> done = nullptr);
void revokePermanent(
not_null<PeerData*> peer,
Fn<void(Link)> done = nullptr);
void setPermanent(
not_null<PeerData*> peer,