mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show joined list on permanent link "N joined" click.
This commit is contained in:
parent
e4ac810773
commit
81ff4d7497
2 changed files with 20 additions and 3 deletions
|
@ -884,6 +884,9 @@ void AddPermanentLinkBlock(
|
||||||
const auto value = container->lifetime().make_state<
|
const auto value = container->lifetime().make_state<
|
||||||
rpl::variable<LinkData>
|
rpl::variable<LinkData>
|
||||||
>();
|
>();
|
||||||
|
const auto currentLinkFields = container->lifetime().make_state<
|
||||||
|
Api::InviteLink
|
||||||
|
>(Api::InviteLink{ .admin = admin });
|
||||||
if (admin->isSelf()) {
|
if (admin->isSelf()) {
|
||||||
*value = peer->session().changes().peerFlagsValue(
|
*value = peer->session().changes().peerFlagsValue(
|
||||||
peer,
|
peer,
|
||||||
|
@ -892,11 +895,19 @@ void AddPermanentLinkBlock(
|
||||||
const auto &links = peer->session().api().inviteLinks().myLinks(
|
const auto &links = peer->session().api().inviteLinks().myLinks(
|
||||||
peer).links;
|
peer).links;
|
||||||
const auto link = links.empty() ? nullptr : &links.front();
|
const auto link = links.empty() ? nullptr : &links.front();
|
||||||
return (link && link->permanent && !link->revoked)
|
if (link && link->permanent && !link->revoked) {
|
||||||
? LinkData{ link->link, link->usage }
|
*currentLinkFields = *link;
|
||||||
: LinkData();
|
return LinkData{ link->link, link->usage };
|
||||||
|
}
|
||||||
|
return LinkData();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
rpl::duplicate(
|
||||||
|
fromList
|
||||||
|
) | rpl::start_with_next([=](const Api::InviteLink &link) {
|
||||||
|
*currentLinkFields = link;
|
||||||
|
}, container->lifetime());
|
||||||
|
|
||||||
*value = std::move(
|
*value = std::move(
|
||||||
fromList
|
fromList
|
||||||
) | rpl::map([](const Api::InviteLink &link) {
|
) | rpl::map([](const Api::InviteLink &link) {
|
||||||
|
@ -1055,6 +1066,9 @@ void AddPermanentLinkBlock(
|
||||||
state->content.value(),
|
state->content.value(),
|
||||||
st::inviteLinkJoinedRowPadding
|
st::inviteLinkJoinedRowPadding
|
||||||
)->setClickedCallback([=] {
|
)->setClickedCallback([=] {
|
||||||
|
if (!currentLinkFields->link.isEmpty()) {
|
||||||
|
ShowInviteLinkBox(peer, *currentLinkFields);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
container->add(object_ptr<Ui::SlideWrap<Ui::FixedHeightWidget>>(
|
container->add(object_ptr<Ui::SlideWrap<Ui::FixedHeightWidget>>(
|
||||||
|
|
|
@ -118,6 +118,9 @@ not_null<AbstractButton*> AddJoinedCountButton(
|
||||||
result->setAttribute(
|
result->setAttribute(
|
||||||
Qt::WA_TransparentForMouseEvents,
|
Qt::WA_TransparentForMouseEvents,
|
||||||
!state->content.count);
|
!state->content.count);
|
||||||
|
if (!state->content.count) {
|
||||||
|
result->clearState();
|
||||||
|
}
|
||||||
const auto &st = st::inviteLinkUserpics;
|
const auto &st = st::inviteLinkUserpics;
|
||||||
const auto imageWidth = !state->content.userpics.isNull()
|
const auto imageWidth = !state->content.userpics.isNull()
|
||||||
? state->content.userpics.width() / style::DevicePixelRatio()
|
? state->content.userpics.width() / style::DevicePixelRatio()
|
||||||
|
|
Loading…
Add table
Reference in a new issue