Return rich invite links section.

This commit is contained in:
John Preston 2021-02-02 14:43:38 +04:00
parent 502a3ca70f
commit 9d3edb785c
6 changed files with 282 additions and 286 deletions

View File

@ -41,27 +41,26 @@ void RemovePermanent(PeerInviteLinks &links) {
} // namespace
// #TODO links
//JoinedByLinkSlice ParseJoinedByLinkSlice(
// not_null<PeerData*> peer,
// const MTPmessages_ChatInviteImporters &slice) {
// auto result = JoinedByLinkSlice();
// slice.match([&](const MTPDmessages_chatInviteImporters &data) {
// auto &owner = peer->session().data();
// owner.processUsers(data.vusers());
// result.count = data.vcount().v;
// result.users.reserve(data.vimporters().v.size());
// for (const auto importer : data.vimporters().v) {
// importer.match([&](const MTPDchatInviteImporter &data) {
// result.users.push_back({
// .user = owner.user(data.vuser_id().v),
// .date = data.vdate().v,
// });
// });
// }
// });
// return result;
//}
JoinedByLinkSlice ParseJoinedByLinkSlice(
not_null<PeerData*> peer,
const MTPmessages_ChatInviteImporters &slice) {
auto result = JoinedByLinkSlice();
slice.match([&](const MTPDmessages_chatInviteImporters &data) {
auto &owner = peer->session().data();
owner.processUsers(data.vusers());
result.count = data.vcount().v;
result.users.reserve(data.vimporters().v.size());
for (const auto importer : data.vimporters().v) {
importer.match([&](const MTPDchatInviteImporter &data) {
result.users.push_back({
.user = owner.user(data.vuser_id().v),
.date = data.vdate().v,
});
});
}
});
return result;
}
InviteLinks::InviteLinks(not_null<ApiWrap*> api) : _api(api) {
}
@ -216,51 +215,55 @@ void InviteLinks::performEdit(
if (done) {
callbacks.push_back(std::move(done));
}
// #TODO links
//using Flag = MTPmessages_EditExportedChatInvite::Flag;
//_api->request(MTPmessages_EditExportedChatInvite(
// MTP_flags((revoke ? Flag::f_revoked : Flag(0))
// | ((!revoke && expireDate) ? Flag::f_expire_date : Flag(0))
// | ((!revoke && usageLimit) ? Flag::f_usage_limit : Flag(0))),
// peer->input,
// MTP_string(link),
// MTP_int(expireDate),
// MTP_int(usageLimit)
//)).done([=](const MTPmessages_ExportedChatInvite &result) {
// const auto callbacks = _editCallbacks.take(key);
// const auto peer = key.peer;
// result.match([&](const MTPDmessages_exportedChatInvite &data) {
// _api->session().data().processUsers(data.vusers());
// const auto link = parse(peer, data.vinvite());
// auto i = _firstSlices.find(peer);
// if (i != end(_firstSlices)) {
// const auto j = ranges::find(
// i->second.links,
// key.link,
// &Link::link);
// if (j != end(i->second.links)) {
// if (link.revoked && !j->revoked) {
// i->second.links.erase(j);
// if (i->second.count > 0) {
// --i->second.count;
// }
// } else {
// *j = link;
// }
// }
// }
// for (const auto &callback : *callbacks) {
// callback(link);
// }
// _updates.fire(Update{
// .peer = peer,
// .was = key.link,
// .now = link,
// });
// });
//}).fail([=](const RPCError &error) {
// _editCallbacks.erase(key);
//}).send();
using Flag = MTPmessages_EditExportedChatInvite::Flag;
_api->request(MTPmessages_EditExportedChatInvite(
MTP_flags((revoke ? Flag::f_revoked : Flag(0))
| ((!revoke && expireDate) ? Flag::f_expire_date : Flag(0))
| ((!revoke && usageLimit) ? Flag::f_usage_limit : Flag(0))),
peer->input,
MTP_string(link),
MTP_int(expireDate),
MTP_int(usageLimit)
)).done([=](const MTPmessages_ExportedChatInvite &result) {
const auto callbacks = _editCallbacks.take(key);
const auto peer = key.peer;
result.match([&](const auto &data) {
_api->session().data().processUsers(data.vusers());
const auto link = parse(peer, data.vinvite());
auto i = _firstSlices.find(peer);
if (i != end(_firstSlices)) {
const auto j = ranges::find(
i->second.links,
key.link,
&Link::link);
if (j != end(i->second.links)) {
if (link.revoked && !j->revoked) {
i->second.links.erase(j);
if (i->second.count > 0) {
--i->second.count;
}
} else {
*j = link;
}
}
}
for (const auto &callback : *callbacks) {
callback(link);
}
_updates.fire(Update{
.peer = peer,
.was = key.link,
.now = link,
});
using Replaced = MTPDmessages_exportedChatInviteReplaced;
if constexpr (Replaced::Is<decltype(data)>()) {
prepend(peer, data.vnew_invite());
}
});
}).fail([=](const RPCError &error) {
_editCallbacks.erase(key);
}).send();
}
void InviteLinks::revoke(
@ -272,8 +275,13 @@ void InviteLinks::revoke(
void InviteLinks::revokePermanent(
not_null<PeerData*> peer,
Fn<void(Link)> done) {
performCreate(peer, std::move(done), true);
Fn<void()> done) {
const auto callback = [=](auto&&) { done(); };
if (const auto permanent = lookupPermanent(peer)) {
performEdit(peer, permanent->link, callback, true);
} else {
performCreate(peer, callback, true);
}
}
void InviteLinks::destroy(
@ -294,24 +302,23 @@ void InviteLinks::destroy(
if (done) {
callbacks.push_back(std::move(done));
}
// #TODO links
//_api->request(MTPmessages_DeleteExportedChatInvite(
// peer->input,
// MTP_string(link)
//)).done([=](const MTPBool &result) {
// const auto callbacks = _deleteCallbacks.take(key);
// if (callbacks) {
// for (const auto &callback : *callbacks) {
// callback();
// }
// }
// _updates.fire(Update{
// .peer = peer,
// .was = key.link,
// });
//}).fail([=](const RPCError &error) {
// _deleteCallbacks.erase(key);
//}).send();
_api->request(MTPmessages_DeleteExportedChatInvite(
peer->input,
MTP_string(link)
)).done([=](const MTPBool &result) {
const auto callbacks = _deleteCallbacks.take(key);
if (callbacks) {
for (const auto &callback : *callbacks) {
callback();
}
}
_updates.fire(Update{
.peer = peer,
.was = key.link,
});
}).fail([=](const RPCError &error) {
_deleteCallbacks.erase(key);
}).send();
}
void InviteLinks::destroyAllRevoked(
@ -328,62 +335,61 @@ void InviteLinks::destroyAllRevoked(
if (done) {
callbacks.push_back(std::move(done));
}
// #TODO links
//_api->request(MTPmessages_DeleteRevokedExportedChatInvites(
// peer->input
//)).done([=](const MTPBool &result) {
// if (const auto callbacks = _deleteRevokedCallbacks.take(peer)) {
// for (const auto &callback : *callbacks) {
// callback();
// }
// }
// _allRevokedDestroyed.fire_copy(peer);
//}).fail([=](const RPCError &error) {
//}).send();
_api->request(MTPmessages_DeleteRevokedExportedChatInvites(
peer->input,
MTP_inputUserSelf()
)).done([=](const MTPBool &result) {
if (const auto callbacks = _deleteRevokedCallbacks.take(peer)) {
for (const auto &callback : *callbacks) {
callback();
}
}
_allRevokedDestroyed.fire_copy(peer);
}).fail([=](const RPCError &error) {
}).send();
}
void InviteLinks::requestLinks(not_null<PeerData*> peer) {
if (_firstSliceRequests.contains(peer)) {
return;
}
// #TODO links
//const auto requestId = _api->request(MTPmessages_GetExportedChatInvites(
// MTP_flags(0),
// peer->input,
// MTPInputUser(), // admin_id
// MTPint(), // offset_date
// MTPstring(), // offset_link
// MTP_int(kFirstPage)
//)).done([=](const MTPmessages_ExportedChatInvites &result) {
// _firstSliceRequests.remove(peer);
// auto slice = parseSlice(peer, result);
// auto i = _firstSlices.find(peer);
// const auto permanent = (i != end(_firstSlices))
// ? lookupPermanent(i->second)
// : nullptr;
// if (!permanent) {
// BringPermanentToFront(slice);
// const auto j = _firstSlices.emplace_or_assign(
// peer,
// std::move(slice)).first;
// if (const auto permanent = lookupPermanent(j->second)) {
// editPermanentLink(peer, permanent->link);
// }
// } else {
// RemovePermanent(slice);
// auto &existing = i->second.links;
// existing.erase(begin(existing) + 1, end(existing));
// existing.insert(
// end(existing),
// begin(slice.links),
// end(slice.links));
// i->second.count = std::max(slice.count, int(existing.size()));
// }
// notify(peer);
//}).fail([=](const RPCError &error) {
// _firstSliceRequests.remove(peer);
//}).send();
//_firstSliceRequests.emplace(peer, requestId);
const auto requestId = _api->request(MTPmessages_GetExportedChatInvites(
MTP_flags(0),
peer->input,
MTP_inputUserSelf(),
MTPint(), // offset_date
MTPstring(), // offset_link
MTP_int(kFirstPage)
)).done([=](const MTPmessages_ExportedChatInvites &result) {
_firstSliceRequests.remove(peer);
auto slice = parseSlice(peer, result);
auto i = _firstSlices.find(peer);
const auto permanent = (i != end(_firstSlices))
? lookupPermanent(i->second)
: nullptr;
if (!permanent) {
BringPermanentToFront(slice);
const auto j = _firstSlices.emplace_or_assign(
peer,
std::move(slice)).first;
if (const auto permanent = lookupPermanent(j->second)) {
editPermanentLink(peer, permanent->link);
}
} else {
RemovePermanent(slice);
auto &existing = i->second.links;
existing.erase(begin(existing) + 1, end(existing));
existing.insert(
end(existing),
begin(slice.links),
end(slice.links));
i->second.count = std::max(slice.count, int(existing.size()));
}
notify(peer);
}).fail([=](const RPCError &error) {
_firstSliceRequests.remove(peer);
}).send();
_firstSliceRequests.emplace(peer, requestId);
}
std::optional<JoinedByLinkSlice> InviteLinks::lookupJoinedFirstSlice(
@ -444,23 +450,23 @@ rpl::producer<> InviteLinks::allRevokedDestroyed(
}
void InviteLinks::requestJoinedFirstSlice(LinkKey key) {
//if (_firstJoinedRequests.contains(key)) { // #TODO links
// return;
//}
//const auto requestId = _api->request(MTPmessages_GetChatInviteImporters(
// key.peer->input,
// MTP_string(key.link),
// MTP_int(0), // offset_date
// MTP_inputUserEmpty(), // offset_user
// MTP_int(kJoinedFirstPage)
//)).done([=](const MTPmessages_ChatInviteImporters &result) {
// _firstJoinedRequests.remove(key);
// _firstJoined[key] = ParseJoinedByLinkSlice(key.peer, result);
// _joinedFirstSliceLoaded.fire_copy(key);
//}).fail([=](const RPCError &error) {
// _firstJoinedRequests.remove(key);
//}).send();
//_firstJoinedRequests.emplace(key, requestId);
if (_firstJoinedRequests.contains(key)) {
return;
}
const auto requestId = _api->request(MTPmessages_GetChatInviteImporters(
key.peer->input,
MTP_string(key.link),
MTP_int(0), // offset_date
MTP_inputUserEmpty(), // offset_user
MTP_int(kJoinedFirstPage)
)).done([=](const MTPmessages_ChatInviteImporters &result) {
_firstJoinedRequests.remove(key);
_firstJoined[key] = ParseJoinedByLinkSlice(key.peer, result);
_joinedFirstSliceLoaded.fire_copy(key);
}).fail([=](const RPCError &error) {
_firstJoinedRequests.remove(key);
}).send();
_firstJoinedRequests.emplace(key, requestId);
}
void InviteLinks::setPermanent(
@ -548,27 +554,27 @@ auto InviteLinks::links(not_null<PeerData*> peer) const -> const Links & {
const auto i = _firstSlices.find(peer);
return (i != end(_firstSlices)) ? i->second : kEmpty;
}
// #TODO links
//auto InviteLinks::parseSlice(
// not_null<PeerData*> peer,
// const MTPmessages_ExportedChatInvites &slice) const -> Links {
// auto i = _firstSlices.find(peer);
// const auto permanent = (i != end(_firstSlices))
// ? lookupPermanent(i->second)
// : nullptr;
// auto result = Links();
// slice.match([&](const MTPDmessages_exportedChatInvites &data) {
// peer->session().data().processUsers(data.vusers());
// result.count = data.vcount().v;
// for (const auto &invite : data.vinvites().v) {
// const auto link = parse(peer, invite);
// if (!permanent || link.link != permanent->link) {
// result.links.push_back(link);
// }
// }
// });
// return result;
//}
auto InviteLinks::parseSlice(
not_null<PeerData*> peer,
const MTPmessages_ExportedChatInvites &slice) const -> Links {
auto i = _firstSlices.find(peer);
const auto permanent = (i != end(_firstSlices))
? lookupPermanent(i->second)
: nullptr;
auto result = Links();
slice.match([&](const MTPDmessages_exportedChatInvites &data) {
peer->session().data().processUsers(data.vusers());
result.count = data.vcount().v;
for (const auto &invite : data.vinvites().v) {
const auto link = parse(peer, invite);
if (!permanent || link.link != permanent->link) {
result.links.push_back(link);
}
}
});
return result;
}
auto InviteLinks::parse(
not_null<PeerData*> peer,
@ -582,7 +588,7 @@ auto InviteLinks::parse(
.expireDate = data.vexpire_date().value_or_empty(),
.usageLimit = data.vusage_limit().value_or_empty(),
.usage = data.vusage().value_or_empty(),
.permanent = true,//data.is_permanent(), // #TODO links
.permanent = data.is_permanent(),
.revoked = data.is_revoked(),
};
});
@ -594,23 +600,22 @@ void InviteLinks::requestMoreLinks(
const QString &lastLink,
bool revoked,
Fn<void(Links)> done) {
// #TODO links
//using Flag = MTPmessages_GetExportedChatInvites::Flag;
//_api->request(MTPmessages_GetExportedChatInvites(
// MTP_flags(Flag::f_offset_link
// | (revoked ? Flag::f_revoked : Flag(0))),
// peer->input,
// MTPInputUser(), // admin_id,
// MTP_int(lastDate),
// MTP_string(lastLink),
// MTP_int(kPerPage)
//)).done([=](const MTPmessages_ExportedChatInvites &result) {
// auto slice = parseSlice(peer, result);
// RemovePermanent(slice);
// done(std::move(slice));
//}).fail([=](const RPCError &error) {
// done(Links());
//}).send();
using Flag = MTPmessages_GetExportedChatInvites::Flag;
_api->request(MTPmessages_GetExportedChatInvites(
MTP_flags(Flag::f_offset_link
| (revoked ? Flag::f_revoked : Flag(0))),
peer->input,
MTP_inputUserSelf(),
MTP_int(lastDate),
MTP_string(lastLink),
MTP_int(kPerPage)
)).done([=](const MTPmessages_ExportedChatInvites &result) {
auto slice = parseSlice(peer, result);
RemovePermanent(slice);
done(std::move(slice));
}).fail([=](const RPCError &error) {
done(Links());
}).send();
}
void InviteLinks::editPermanentLink(

View File

@ -43,10 +43,10 @@ struct InviteLinkUpdate {
QString was;
std::optional<InviteLink> now;
};
// #TODO links
//[[nodiscard]] JoinedByLinkSlice ParseJoinedByLinkSlice(
// not_null<PeerData*> peer,
// const MTPmessages_ChatInviteImporters &slice);
[[nodiscard]] JoinedByLinkSlice ParseJoinedByLinkSlice(
not_null<PeerData*> peer,
const MTPmessages_ChatInviteImporters &slice);
class InviteLinks final {
public:
@ -73,7 +73,7 @@ public:
Fn<void(Link)> done = nullptr);
void revokePermanent(
not_null<PeerData*> peer,
Fn<void(Link)> done = nullptr);
Fn<void()> done = nullptr);
void destroy(
not_null<PeerData*> peer,
const QString &link,
@ -124,10 +124,9 @@ private:
}
};
// #TODO links
//[[nodiscard]] Links parseSlice(
// not_null<PeerData*> peer,
// const MTPmessages_ExportedChatInvites &slice) const;
[[nodiscard]] Links parseSlice(
not_null<PeerData*> peer,
const MTPmessages_ExportedChatInvites &slice) const;
[[nodiscard]] Link parse(
not_null<PeerData*> peer,
const MTPExportedChatInvite &invite) const;

View File

@ -332,7 +332,7 @@ private:
void showEditLinkedChatBox();
void fillPrivacyTypeButton();
void fillLinkedChatButton();
void fillInviteLinkButton();
//void fillInviteLinkButton();
void fillSignaturesButton();
void fillHistoryVisibilityButton();
void fillManageSection();
@ -798,20 +798,20 @@ void Controller::fillLinkedChatButton() {
[=] { showEditLinkedChatBox(); });
_linkedChatUpdates.fire_copy(*_linkedChatSavedValue);
}
void Controller::fillInviteLinkButton() {
Expects(_controls.buttonsLayout != nullptr);
const auto buttonCallback = [=] {
Ui::show(Box<EditPeerTypeBox>(_peer), Ui::LayerOption::KeepOther);
};
AddButtonWithText(
_controls.buttonsLayout,
tr::lng_profile_invite_link_section(),
rpl::single(QString()), //Empty text.
buttonCallback);
}
//
//void Controller::fillInviteLinkButton() {
// Expects(_controls.buttonsLayout != nullptr);
//
// const auto buttonCallback = [=] {
// Ui::show(Box<EditPeerTypeBox>(_peer), Ui::LayerOption::KeepOther);
// };
//
// AddButtonWithText(
// _controls.buttonsLayout,
// tr::lng_profile_invite_link_section(),
// rpl::single(QString()), //Empty text.
// buttonCallback);
//}
void Controller::fillSignaturesButton() {
Expects(_controls.buttonsLayout != nullptr);
@ -959,8 +959,8 @@ void Controller::fillManageSection() {
if (canEditUsername) {
fillPrivacyTypeButton();
} else if (canEditInviteLinks) {
fillInviteLinkButton();
//} else if (canEditInviteLinks) {
// fillInviteLinkButton();
}
if (canViewOrEditLinkedChat) {
fillLinkedChatButton();
@ -995,29 +995,29 @@ void Controller::fillManageSection() {
[=] { ShowEditPermissions(_navigation, _peer); },
st::infoIconPermissions);
}
//if (canEditInviteLinks) { // #TODO links
// AddButtonWithCount(
// _controls.buttonsLayout,
// tr::lng_manage_peer_invite_links(),
// Info::Profile::MigratedOrMeValue(
// _peer
// ) | rpl::map([=](not_null<PeerData*> peer) {
// peer->session().api().inviteLinks().requestLinks(peer);
// return peer->session().changes().peerUpdates(
// peer,
// Data::PeerUpdate::Flag::InviteLinks
// ) | rpl::map([=] {
// return peer->session().api().inviteLinks().links(
// peer).count;
// });
// }) | rpl::flatten_latest(
// ) | ToPositiveNumberString(),
// [=] { Ui::show(
// Box(ManageInviteLinksBox, _peer),
// Ui::LayerOption::KeepOther);
// },
// st::infoIconInviteLinks);
//}
if (canEditInviteLinks) {
AddButtonWithCount(
_controls.buttonsLayout,
tr::lng_manage_peer_invite_links(),
Info::Profile::MigratedOrMeValue(
_peer
) | rpl::map([=](not_null<PeerData*> peer) {
peer->session().api().inviteLinks().requestLinks(peer);
return peer->session().changes().peerUpdates(
peer,
Data::PeerUpdate::Flag::InviteLinks
) | rpl::map([=] {
return peer->session().api().inviteLinks().links(
peer).count;
});
}) | rpl::flatten_latest(
) | ToPositiveNumberString(),
[=] { Ui::show(
Box(ManageInviteLinksBox, _peer),
Ui::LayerOption::KeepOther);
},
st::infoIconInviteLinks);
}
if (canViewAdmins) {
AddButtonWithCount(
_controls.buttonsLayout,

View File

@ -222,22 +222,21 @@ void Controller::loadMoreRows() {
if (_requestId || _allLoaded) {
return;
}
_allLoaded = true; // #TODO links
//_requestId = _api.request(MTPmessages_GetChatInviteImporters(
// _peer->input,
// MTP_string(_data.link),
// MTP_int(_lastUser ? _lastUser->date : 0),
// _lastUser ? _lastUser->user->inputUser : MTP_inputUserEmpty(),
// MTP_int(_lastUser ? kPerPage : kFirstPage)
//)).done([=](const MTPmessages_ChatInviteImporters &result) {
// _requestId = 0;
// auto slice = Api::ParseJoinedByLinkSlice(_peer, result);
// _allLoaded = slice.users.empty();
// appendSlice(slice);
//}).fail([=](const RPCError &error) {
// _requestId = 0;
// _allLoaded = true;
//}).send();
_requestId = _api.request(MTPmessages_GetChatInviteImporters(
_peer->input,
MTP_string(_data.link),
MTP_int(_lastUser ? _lastUser->date : 0),
_lastUser ? _lastUser->user->inputUser : MTP_inputUserEmpty(),
MTP_int(_lastUser ? kPerPage : kFirstPage)
)).done([=](const MTPmessages_ChatInviteImporters &result) {
_requestId = 0;
auto slice = Api::ParseJoinedByLinkSlice(_peer, result);
_allLoaded = slice.users.empty();
appendSlice(slice);
}).fail([=](const RPCError &error) {
_requestId = 0;
_allLoaded = true;
}).send();
}
void Controller::appendSlice(const Api::JoinedByLinkSlice &slice) {
@ -318,7 +317,7 @@ void AddPermanentLinkBlock(
const auto revokeLink = crl::guard(weak, [=] {
const auto box = std::make_shared<QPointer<ConfirmBox>>();
const auto done = crl::guard(weak, [=] {
const auto close = [=](auto&&) {
const auto close = [=] {
if (*box) {
(*box)->closeBox();
}

View File

@ -441,8 +441,10 @@ Controller::Controller(not_null<PeerData*> peer, bool revoked)
delegate()->peerListRefreshRows();
}
} else if (update.was.isEmpty()) {
prependRow(*update.now, now);
delegate()->peerListRefreshRows();
if (!update.now->permanent || update.now->revoked) {
prependRow(*update.now, now);
delegate()->peerListRefreshRows();
}
} else {
updateRow(*update.now, now);
}
@ -581,6 +583,8 @@ void Controller::updateRow(const InviteLinkData &data, TimeId now) {
real->update(data, now);
checkExpiringTimer(real);
delegate()->peerListUpdateRow(row);
} else if (_revoked) {
prependRow(data, now);
}
}

View File

@ -186,20 +186,20 @@ void Controller::createContent() {
_wrap->add(createUsernameEdit());
}
//using namespace Settings; // #TODO links
//AddSkip(_wrap.get());
//_wrap->add(EditPeerInfoBox::CreateButton(
// _wrap.get(),
// tr::lng_group_invite_manage(),
// rpl::single(QString()),
// [=] { Ui::show(
// Box(ManageInviteLinksBox, _peer),
// Ui::LayerOption::KeepOther);
// },
// st::manageGroupButton,
// &st::infoIconInviteLinks));
//AddSkip(_wrap.get());
//AddDividerText(_wrap.get(), tr::lng_group_invite_manage_about());
using namespace Settings;
AddSkip(_wrap.get());
_wrap->add(EditPeerInfoBox::CreateButton(
_wrap.get(),
tr::lng_group_invite_manage(),
rpl::single(QString()),
[=] { Ui::show(
Box(ManageInviteLinksBox, _peer),
Ui::LayerOption::KeepOther);
},
st::manageGroupButton,
&st::infoIconInviteLinks));
AddSkip(_wrap.get());
AddDividerText(_wrap.get(), tr::lng_group_invite_manage_about());
if (_linkOnly) {
_controls.inviteLinkWrap->show(anim::type::instant);
@ -564,9 +564,8 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkBlock() {
if (_privacySavedValue) {
AddSkip(container);
AddSubsectionTitle(container, tr::lng_create_invite_link_title());
AddSubsectionTitle(container, tr::lng_create_permanent_link_title());
}
// tr::lng_create_permanent_link_title()); // #TODO links
AddPermanentLinkBlock(container, _peer);
AddSkip(container);
@ -577,16 +576,6 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkBlock() {
? tr::lng_group_invite_about_permanent_group()
: tr::lng_group_invite_about_permanent_channel()));
if (_peer->wasFullUpdated()) {
const auto link = _peer->isChat()
? _peer->asChat()->inviteLink()
: _peer->asChannel()->inviteLink();
if (link.isEmpty()) {
// #TODO links remove this auto-export link.
_peer->session().api().inviteLinks().revokePermanent(_peer);
}
}
return result;
}