2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Improve permanent link edit design.

This commit is contained in:
John Preston
2021-01-15 15:42:26 +04:00
parent e5320b4b4e
commit 754dedc40e
12 changed files with 332 additions and 111 deletions

View File

@@ -254,12 +254,11 @@ void InviteLinks::setPermanent(
not_null<PeerData*> peer,
const MTPExportedChatInvite &invite) {
auto link = parse(peer, invite);
link.permanent = true; // #TODO links remove hack
//if (!link.permanent) {
// LOG(("API Error: "
// "InviteLinks::setPermanent called with non-permanent link."));
// return;
//}
if (!link.permanent) {
LOG(("API Error: "
"InviteLinks::setPermanent called with non-permanent link."));
return;
}
auto i = _firstSlices.find(peer);
if (i == end(_firstSlices)) {
i = _firstSlices.emplace(peer).first;
@@ -294,9 +293,10 @@ void InviteLinks::notify(not_null<PeerData*> peer) {
Data::PeerUpdate::Flag::InviteLinks);
}
auto InviteLinks::links(not_null<PeerData*> peer) const -> Links {
auto InviteLinks::links(not_null<PeerData*> peer) const -> const Links & {
static const auto kEmpty = Links();
const auto i = _firstSlices.find(peer);
return (i != end(_firstSlices)) ? i->second : Links();
return (i != end(_firstSlices)) ? i->second : kEmpty;
}
auto InviteLinks::parseSlice(

View File

@@ -57,7 +57,7 @@ public:
void clearPermanent(not_null<PeerData*> peer);
void requestLinks(not_null<PeerData*> peer);
[[nodiscard]] Links links(not_null<PeerData*> peer) const;
[[nodiscard]] const Links &links(not_null<PeerData*> peer) const;
void requestMoreLinks(
not_null<PeerData*> peer,