mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Version 2.5.8: Fix invite link export if absent.
This commit is contained in:
@@ -120,7 +120,7 @@ private:
|
|||||||
|
|
||||||
void fillPrivaciesButtons(
|
void fillPrivaciesButtons(
|
||||||
not_null<Ui::VerticalLayout*> parent,
|
not_null<Ui::VerticalLayout*> parent,
|
||||||
std::optional<Privacy> savedValue = std::nullopt);
|
Privacy savedValue);
|
||||||
void addRoundButton(
|
void addRoundButton(
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
Privacy value,
|
Privacy value,
|
||||||
@@ -195,6 +195,12 @@ void Controller::createContent() {
|
|||||||
if (_controls.privacy->value() == Privacy::NoUsername) {
|
if (_controls.privacy->value() == Privacy::NoUsername) {
|
||||||
checkUsernameAvailability();
|
checkUsernameAvailability();
|
||||||
}
|
}
|
||||||
|
_controls.inviteLinkWrap->toggle(
|
||||||
|
(_privacySavedValue != Privacy::HasUsername),
|
||||||
|
anim::type::instant);
|
||||||
|
_controls.usernameWrap->toggle(
|
||||||
|
(_privacySavedValue == Privacy::HasUsername),
|
||||||
|
anim::type::instant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::addRoundButton(
|
void Controller::addRoundButton(
|
||||||
@@ -222,7 +228,7 @@ void Controller::addRoundButton(
|
|||||||
|
|
||||||
void Controller::fillPrivaciesButtons(
|
void Controller::fillPrivaciesButtons(
|
||||||
not_null<Ui::VerticalLayout*> parent,
|
not_null<Ui::VerticalLayout*> parent,
|
||||||
std::optional<Privacy> savedValue) {
|
Privacy savedValue) {
|
||||||
const auto canEditUsername = [&] {
|
const auto canEditUsername = [&] {
|
||||||
if (const auto chat = _peer->asChat()) {
|
if (const auto chat = _peer->asChat()) {
|
||||||
return chat->canEditUsername();
|
return chat->canEditUsername();
|
||||||
@@ -245,8 +251,7 @@ void Controller::fillPrivaciesButtons(
|
|||||||
const auto isPublic = _peer->isChannel()
|
const auto isPublic = _peer->isChannel()
|
||||||
&& _peer->asChannel()->hasUsername();
|
&& _peer->asChannel()->hasUsername();
|
||||||
_controls.privacy = std::make_shared<Ui::RadioenumGroup<Privacy>>(
|
_controls.privacy = std::make_shared<Ui::RadioenumGroup<Privacy>>(
|
||||||
savedValue.value_or(
|
savedValue);
|
||||||
isPublic ? Privacy::HasUsername : Privacy::NoUsername));
|
|
||||||
|
|
||||||
addRoundButton(
|
addRoundButton(
|
||||||
container,
|
container,
|
||||||
@@ -543,7 +548,8 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkBlock() {
|
|||||||
using namespace Settings;
|
using namespace Settings;
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
|
|
||||||
AddSubsectionTitle(container, tr::lng_create_permanent_link_title());
|
AddSubsectionTitle(container, tr::lng_create_invite_link_title());
|
||||||
|
// tr::lng_create_permanent_link_title()); // #TODO links
|
||||||
AddPermanentLinkBlock(container, _peer);
|
AddPermanentLinkBlock(container, _peer);
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
@@ -554,6 +560,16 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkBlock() {
|
|||||||
? tr::lng_group_invite_about_permanent_group()
|
? tr::lng_group_invite_about_permanent_group()
|
||||||
: tr::lng_group_invite_about_permanent_channel()));
|
: 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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user