Rename linked-chat to discussion-link.

This commit is contained in:
John Preston 2025-05-06 10:22:29 +04:00
parent 1d2f713673
commit f96f478470
17 changed files with 103 additions and 103 deletions

View file

@ -214,8 +214,8 @@ PRIVATE
boxes/peers/edit_contact_box.h
boxes/peers/edit_forum_topic_box.cpp
boxes/peers/edit_forum_topic_box.h
boxes/peers/edit_linked_chat_box.cpp
boxes/peers/edit_linked_chat_box.h
boxes/peers/edit_discussion_link_box.cpp
boxes/peers/edit_discussion_link_box.h
boxes/peers/edit_members_visible.cpp
boxes/peers/edit_members_visible.h
boxes/peers/edit_participant_box.cpp

View file

@ -77,7 +77,7 @@ ModerateOptions CalculateModerateOptions(const HistoryItemsList &items) {
if (author == peer) {
return {};
} else if (const auto channel = author->asChannel()) {
if (channel->linkedChat() == peer) {
if (channel->discussionLink() == peer) {
return {};
}
}

View file

@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "boxes/peers/edit_linked_chat_box.h"
#include "boxes/peers/edit_discussion_link_box.h"
#include "lang/lang_keys.h"
#include "data/data_channel.h"
@ -224,7 +224,7 @@ void Controller::choose(not_null<ChatData*> chat) {
return tr::lng_manage_discussion_group_about(Ui::Text::WithEntities);
}
[[nodiscard]] object_ptr<Ui::BoxContent> EditLinkedChatBox(
[[nodiscard]] object_ptr<Ui::BoxContent> EditDiscussionLinkBox(
not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel,
ChannelData *chat,
@ -272,7 +272,7 @@ void Controller::choose(not_null<ChatData*> chat) {
Settings::AddButtonWithIcon(
above,
tr::lng_manage_discussion_group_create(),
st::infoCreateLinkedChatButton,
st::infoCreateDiscussionLinkButton,
{ &st::menuIconGroupCreate }
)->addClickHandler([=, parent = above.data()] {
const auto guarded = crl::guard(parent, callback);
@ -292,7 +292,7 @@ void Controller::choose(not_null<ChatData*> chat) {
(channel->isBroadcast()
? tr::lng_manage_discussion_group_unlink
: tr::lng_manage_linked_channel_unlink)(),
st::infoUnlinkChatButton,
st::infoUnlinkDiscussionLinkButton,
{ &st::menuIconRemove }
)->addClickHandler([=] { callback(nullptr); });
Ui::AddSkip(below);
@ -327,12 +327,12 @@ void Controller::choose(not_null<ChatData*> chat) {
} // namespace
object_ptr<Ui::BoxContent> EditLinkedChatBox(
object_ptr<Ui::BoxContent> EditDiscussionLinkBox(
not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel,
std::vector<not_null<PeerData*>> &&chats,
Fn<void(ChannelData*)> callback) {
return EditLinkedChatBox(
return EditDiscussionLinkBox(
navigation,
channel,
nullptr,
@ -341,13 +341,13 @@ object_ptr<Ui::BoxContent> EditLinkedChatBox(
callback);
}
object_ptr<Ui::BoxContent> EditLinkedChatBox(
object_ptr<Ui::BoxContent> EditDiscussionLinkBox(
not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel,
not_null<ChannelData*> chat,
bool canEdit,
Fn<void(ChannelData*)> callback) {
return EditLinkedChatBox(
return EditDiscussionLinkBox(
navigation,
channel,
chat,

View file

@ -17,14 +17,14 @@ namespace Window {
class SessionNavigation;
} // namespace Window
[[nodiscard]] object_ptr<Ui::BoxContent> EditLinkedChatBox(
[[nodiscard]] object_ptr<Ui::BoxContent> EditDiscussionLinkBox(
not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel,
not_null<ChannelData*> chat,
bool canEdit,
Fn<void(ChannelData*)> callback);
[[nodiscard]] object_ptr<Ui::BoxContent> EditLinkedChatBox(
[[nodiscard]] object_ptr<Ui::BoxContent> EditDiscussionLinkBox(
not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel,
std::vector<not_null<PeerData*>> &&chats,

View file

@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/peers/edit_peer_history_visibility_box.h"
#include "boxes/peers/edit_peer_permissions_box.h"
#include "boxes/peers/edit_peer_invite_links.h"
#include "boxes/peers/edit_linked_chat_box.h"
#include "boxes/peers/edit_discussion_link_box.h"
#include "boxes/peers/edit_peer_requests_box.h"
#include "boxes/peers/edit_peer_reactions.h"
#include "boxes/peers/replace_boost_box.h"
@ -364,7 +364,7 @@ private:
std::optional<bool> noForwards;
std::optional<bool> joinToWrite;
std::optional<bool> requestToJoin;
std::optional<ChannelData*> linkedChat;
std::optional<ChannelData*> discussionLink;
};
[[nodiscard]] object_ptr<Ui::RpWidget> createPhotoAndTitleEdit();
@ -380,9 +380,9 @@ private:
void refreshForumToggleLocked();
void showEditPeerTypeBox(
std::optional<rpl::producer<QString>> error = {});
void showEditLinkedChatBox();
void showEditDiscussionLinkBox();
void fillPrivacyTypeButton();
void fillLinkedChatButton();
void fillDiscussionLinkButton();
//void fillInviteLinkButton();
void fillForumButton();
void fillColorIndexButton();
@ -410,7 +410,7 @@ private:
[[nodiscard]] std::optional<Saving> validate() const;
[[nodiscard]] bool validateUsernamesOrder(Saving &to) const;
[[nodiscard]] bool validateUsername(Saving &to) const;
[[nodiscard]] bool validateLinkedChat(Saving &to) const;
[[nodiscard]] bool validateDiscussionLink(Saving &to) const;
[[nodiscard]] bool validateTitle(Saving &to) const;
[[nodiscard]] bool validateDescription(Saving &to) const;
[[nodiscard]] bool validateHistoryVisibility(Saving &to) const;
@ -424,7 +424,7 @@ private:
void save();
void saveUsernamesOrder();
void saveUsername();
void saveLinkedChat();
void saveDiscussionLink();
void saveTitle();
void saveDescription();
void saveHistoryVisibility();
@ -450,8 +450,8 @@ private:
void subscribeToMigration();
void migrate(not_null<ChannelData*> channel);
std::optional<ChannelData*> _linkedChatSavedValue;
ChannelData *_linkedChatOriginalValue = nullptr;
std::optional<ChannelData*> _discussionLinkSavedValue;
ChannelData *_discussionLinkOriginalValue = nullptr;
bool _channelHasLocationOriginalValue = false;
std::optional<HistoryVisibility> _historyVisibilitySavedValue;
std::optional<EditPeerTypeData> _typeDataSavedValue;
@ -479,8 +479,8 @@ private:
};
const rpl::event_stream<PrivacyAndForwards> _privacyTypeUpdates;
const rpl::event_stream<ChannelData*> _linkedChatUpdates;
mtpRequestId _linkedChatsRequestId = 0;
const rpl::event_stream<ChannelData*> _discussionLinkUpdates;
mtpRequestId _discussionLinksRequestId = 0;
rpl::lifetime _lifetime;
@ -820,7 +820,7 @@ void Controller::refreshHistoryVisibility() {
_controls.historyVisibilityWrap->toggle(
(!withUsername
&& !_channelHasLocationOriginalValue
&& (!_linkedChatSavedValue || !*_linkedChatSavedValue)
&& (!_discussionLinkSavedValue || !*_discussionLinkSavedValue)
&& (!_forumSavedValue || !*_forumSavedValue)),
anim::type::instant);
}
@ -832,8 +832,8 @@ void Controller::showEditPeerTypeBox(
_typeDataSavedValue = data;
refreshHistoryVisibility();
});
_typeDataSavedValue->hasLinkedChat
= (_linkedChatSavedValue.value_or(nullptr) != nullptr);
_typeDataSavedValue->hasDiscussionLink
= (_discussionLinkSavedValue.value_or(nullptr) != nullptr);
const auto box = _navigation->parentController()->show(
Box<EditPeerTypeBox>(
_navigation,
@ -848,7 +848,7 @@ void Controller::showEditPeerTypeBox(
}, box->lifetime());
}
void Controller::showEditLinkedChatBox() {
void Controller::showEditDiscussionLinkBox() {
Expects(_peer->isChannel());
if (_forumSavedValue && *_forumSavedValue) {
@ -862,8 +862,8 @@ void Controller::showEditLinkedChatBox() {
if (*box) {
(*box)->closeBox();
}
*_linkedChatSavedValue = result;
_linkedChatUpdates.fire_copy(result);
*_discussionLinkSavedValue = result;
_discussionLinkUpdates.fire_copy(result);
refreshHistoryVisibility();
refreshForumToggleLocked();
};
@ -874,31 +874,31 @@ void Controller::showEditLinkedChatBox() {
&& (!channel->hiddenPreHistory()
|| channel->canEditPreHistoryHidden()));
if (const auto chat = *_linkedChatSavedValue) {
*box = _navigation->parentController()->show(EditLinkedChatBox(
if (const auto chat = *_discussionLinkSavedValue) {
*box = _navigation->parentController()->show(EditDiscussionLinkBox(
_navigation,
channel,
chat,
canEdit,
callback));
return;
} else if (!canEdit || _linkedChatsRequestId) {
} else if (!canEdit || _discussionLinksRequestId) {
return;
} else if (channel->isMegagroup()) {
if (_forumSavedValue
&& *_forumSavedValue
&& _linkedChatOriginalValue) {
&& _discussionLinkOriginalValue) {
ShowForumForDiscussionError(_navigation);
} else {
// Restore original linked channel.
callback(_linkedChatOriginalValue);
// Restore original discussion link.
callback(_discussionLinkOriginalValue);
}
return;
}
_linkedChatsRequestId = _api.request(
_discussionLinksRequestId = _api.request(
MTPchannels_GetGroupsForDiscussion()
).done([=](const MTPmessages_Chats &result) {
_linkedChatsRequestId = 0;
_discussionLinksRequestId = 0;
const auto list = result.match([&](const auto &data) {
return data.vchats().v;
});
@ -907,13 +907,13 @@ void Controller::showEditLinkedChatBox() {
for (const auto &item : list) {
chats.emplace_back(_peer->owner().processChat(item));
}
*box = _navigation->parentController()->show(EditLinkedChatBox(
*box = _navigation->parentController()->show(EditDiscussionLinkBox(
_navigation,
channel,
std::move(chats),
callback));
}).fail([=] {
_linkedChatsRequestId = 0;
_discussionLinksRequestId = 0;
}).send();
}
@ -979,11 +979,11 @@ void Controller::fillPrivacyTypeButton() {
});
}
void Controller::fillLinkedChatButton() {
void Controller::fillDiscussionLinkButton() {
Expects(_controls.buttonsLayout != nullptr);
_linkedChatSavedValue = _linkedChatOriginalValue = _peer->isChannel()
? _peer->asChannel()->linkedChat()
_discussionLinkSavedValue = _discussionLinkOriginalValue = _peer->isChannel()
? _peer->asChannel()->discussionLink()
: nullptr;
const auto isGroup = (_peer->isChat() || _peer->isMegagroup());
@ -992,7 +992,7 @@ void Controller::fillLinkedChatButton() {
: rpl::combine(
tr::lng_manage_linked_channel(),
tr::lng_manage_linked_channel_restore(),
_linkedChatUpdates.events()
_discussionLinkUpdates.events()
) | rpl::map([=](
const QString &edit,
const QString &restore,
@ -1000,13 +1000,13 @@ void Controller::fillLinkedChatButton() {
return chat ? edit : restore;
});
auto label = isGroup
? _linkedChatUpdates.events(
? _discussionLinkUpdates.events(
) | rpl::map([](ChannelData *chat) {
return chat ? chat->name() : QString();
}) | rpl::type_erased()
: rpl::combine(
tr::lng_manage_discussion_group_add(),
_linkedChatUpdates.events()
_discussionLinkUpdates.events()
) | rpl::map([=](const QString &add, ChannelData *chat) {
return chat ? chat->name() : add;
}) | rpl::type_erased();
@ -1014,9 +1014,9 @@ void Controller::fillLinkedChatButton() {
_controls.buttonsLayout,
std::move(text),
std::move(label),
[=] { showEditLinkedChatBox(); },
[=] { showEditDiscussionLinkBox(); },
{ isGroup ? &st::menuIconChannel : &st::menuIconGroups });
_linkedChatUpdates.fire_copy(*_linkedChatSavedValue);
_discussionLinkUpdates.fire_copy(*_discussionLinkSavedValue);
}
//
//void Controller::fillInviteLinkButton() {
@ -1051,7 +1051,7 @@ void Controller::fillForumButton() {
) | rpl::start_with_next([=](bool toggled) {
if (_controls.forumToggleLocked && toggled) {
unlocks->fire(false);
if (_linkedChatSavedValue && *_linkedChatSavedValue) {
if (_discussionLinkSavedValue && *_discussionLinkSavedValue) {
ShowForumForDiscussionError(_navigation);
} else {
_navigation->showToast(
@ -1081,8 +1081,8 @@ void Controller::refreshForumToggleLocked() {
const auto channel = _peer->asChannel();
const auto notenough = !_peer->isForum()
&& ((chat ? chat->count : channel->membersCount()) < limit);
const auto linked = _linkedChatSavedValue
&& *_linkedChatSavedValue;
const auto linked = _discussionLinkSavedValue
&& *_discussionLinkSavedValue;
const auto locked = _controls.forumToggleLocked = notenough || linked;
_controls.forumToggle->setToggleLocked(locked);
}
@ -1355,8 +1355,8 @@ void Controller::fillManageSection() {
const auto canEditStickers = isChannel && channel->canEditStickers();
const auto canDeleteChannel = isChannel && channel->canDelete();
const auto canEditColorIndex = isChannel && channel->canEditEmoji();
const auto canViewOrEditLinkedChat = isChannel
&& (channel->linkedChat()
const auto canViewOrEditDiscussionLink = isChannel
&& (channel->discussionLink()
|| (channel->isBroadcast() && channel->canEditInformation()));
::AddSkip(_controls.buttonsLayout, 0);
@ -1366,8 +1366,8 @@ void Controller::fillManageSection() {
//} else if (canEditInviteLinks) {
// fillInviteLinkButton();
}
if (canViewOrEditLinkedChat) {
fillLinkedChatButton();
if (canViewOrEditDiscussionLink) {
fillDiscussionLinkButton();
}
if (canEditPreHistoryHidden) {
fillHistoryVisibilityButton();
@ -1387,7 +1387,7 @@ void Controller::fillManageSection() {
|| canEditForum
|| canEditColorIndex
//|| canEditInviteLinks
|| canViewOrEditLinkedChat
|| canViewOrEditDiscussionLink
|| canEditType) {
::AddSkip(_controls.buttonsLayout);
}
@ -1971,7 +1971,7 @@ std::optional<Controller::Saving> Controller::validate() const {
auto result = Saving();
if (validateUsernamesOrder(result)
&& validateUsername(result)
&& validateLinkedChat(result)
&& validateDiscussionLink(result)
&& validateTitle(result)
&& validateDescription(result)
&& validateHistoryVisibility(result)
@ -2013,11 +2013,11 @@ bool Controller::validateUsername(Saving &to) const {
return true;
}
bool Controller::validateLinkedChat(Saving &to) const {
if (!_linkedChatSavedValue) {
bool Controller::validateDiscussionLink(Saving &to) const {
if (!_discussionLinkSavedValue) {
return true;
}
to.linkedChat = *_linkedChatSavedValue;
to.discussionLink = *_discussionLinkSavedValue;
return true;
}
@ -2118,7 +2118,7 @@ void Controller::save() {
_savingData = *saving;
pushSaveStage([=] { saveUsernamesOrder(); });
pushSaveStage([=] { saveUsername(); });
pushSaveStage([=] { saveLinkedChat(); });
pushSaveStage([=] { saveDiscussionLink(); });
pushSaveStage([=] { saveTitle(); });
pushSaveStage([=] { saveDescription(); });
pushSaveStage([=] { saveHistoryVisibility(); });
@ -2241,34 +2241,34 @@ void Controller::saveUsername() {
}).send();
}
void Controller::saveLinkedChat() {
void Controller::saveDiscussionLink() {
const auto channel = _peer->asChannel();
if (!channel) {
return continueSave();
}
if (!_savingData.linkedChat
|| *_savingData.linkedChat == channel->linkedChat()) {
if (!_savingData.discussionLink
|| *_savingData.discussionLink == channel->discussionLink()) {
return continueSave();
}
const auto chat = *_savingData.linkedChat;
const auto chat = *_savingData.discussionLink;
if (channel->isBroadcast() && chat && chat->hiddenPreHistory()) {
togglePreHistoryHidden(
chat,
false,
[=] { saveLinkedChat(); },
[=] { saveDiscussionLink(); },
[=] { cancelSave(); });
return;
}
const auto input = *_savingData.linkedChat
? (*_savingData.linkedChat)->inputChannel
const auto input = *_savingData.discussionLink
? (*_savingData.discussionLink)->inputChannel
: MTP_inputChannelEmpty();
_api.request(MTPchannels_SetDiscussionGroup(
(channel->isBroadcast() ? channel->inputChannel : input),
(channel->isBroadcast() ? input : channel->inputChannel)
)).done([=] {
channel->setLinkedChat(*_savingData.linkedChat);
channel->setDiscussionLink(*_savingData.discussionLink);
continueSave();
}).fail([=](const MTP::Error &error) {
_navigation->showToast(error.type());

View file

@ -1138,7 +1138,7 @@ void ShowEditPeerPermissionsBox(
result.emplace(
Flag::ChangeInfo | Flag::PinMessages,
tr::lng_rights_permission_unavailable(tr::now));
} else if (channel->isMegagroup() && channel->linkedChat()) {
} else if (channel->isMegagroup() && channel->discussionLink()) {
result.emplace(
Flag::ChangeInfo | Flag::PinMessages,
tr::lng_rights_permission_in_discuss(tr::now));

View file

@ -220,7 +220,7 @@ void Controller::createContent() {
const auto wrap = _controls.whoSendWrap->entity();
Ui::AddSkip(wrap);
if (_dataSavedValue->hasLinkedChat) {
if (_dataSavedValue->hasDiscussionLink) {
Ui::AddSubsectionTitle(wrap, tr::lng_manage_peer_send_title());
_controls.joinToWrite = wrap->add(EditPeerInfoBox::CreateButton(
@ -498,7 +498,7 @@ void Controller::privacyChanged(Privacy value) {
}
_controls.whoSendWrap->toggle(
(value == Privacy::HasUsername
|| (_dataSavedValue && _dataSavedValue->hasLinkedChat)),
|| (_dataSavedValue && _dataSavedValue->hasDiscussionLink)),
anim::type::instant);
};
const auto refreshVisibilities = [&] {

View file

@ -37,7 +37,7 @@ struct EditPeerTypeData {
Privacy privacy = Privacy::NoUsername;
QString username;
std::vector<QString> usernamesOrder;
bool hasLinkedChat = false;
bool hasDiscussionLink = false;
bool noForwards = false;
bool joinToWrite = false;
bool requestToJoin = false;

View file

@ -111,7 +111,7 @@ struct PeerUpdate {
ChannelAmIn = (1ULL << 45),
StickersSet = (1ULL << 46),
EmojiSet = (1ULL << 47),
ChannelLinkedChat = (1ULL << 48),
DiscussionLink = (1ULL << 48),
ChannelLocation = (1ULL << 49),
Slowmode = (1ULL << 50),
GroupCall = (1ULL << 51),

View file

@ -275,22 +275,22 @@ const ChannelLocation *ChannelData::getLocation() const {
return mgInfo ? mgInfo->getLocation() : nullptr;
}
void ChannelData::setLinkedChat(ChannelData *linked) {
if (_linkedChat != linked) {
_linkedChat = linked;
void ChannelData::setDiscussionLink(ChannelData *linked) {
if (_discussionLink != linked) {
_discussionLink = linked;
if (const auto history = owner().historyLoaded(this)) {
history->forceFullResize();
}
session().changes().peerUpdated(this, UpdateFlag::ChannelLinkedChat);
session().changes().peerUpdated(this, UpdateFlag::DiscussionLink);
}
}
ChannelData *ChannelData::linkedChat() const {
return _linkedChat.value_or(nullptr);
ChannelData *ChannelData::discussionLink() const {
return _discussionLink.value_or(nullptr);
}
bool ChannelData::linkedChatKnown() const {
return _linkedChat.has_value();
bool ChannelData::discussionLinkKnown() const {
return _discussionLink.has_value();
}
void ChannelData::setMembersCount(int newMembersCount) {
@ -1236,9 +1236,9 @@ void ApplyChannelUpdate(
channel->setLocation(MTP_channelLocationEmpty());
}
if (const auto chat = update.vlinked_chat_id()) {
channel->setLinkedChat(channel->owner().channelLoaded(chat->v));
channel->setDiscussionLink(channel->owner().channelLoaded(chat->v));
} else {
channel->setLinkedChat(nullptr);
channel->setDiscussionLink(nullptr);
}
if (const auto history = channel->owner().historyLoaded(channel)) {
if (const auto available = update.vavailable_min_id()) {

View file

@ -409,9 +409,9 @@ public:
void setLocation(const MTPChannelLocation &data);
[[nodiscard]] const ChannelLocation *getLocation() const;
void setLinkedChat(ChannelData *linked);
[[nodiscard]] ChannelData *linkedChat() const;
[[nodiscard]] bool linkedChatKnown() const;
void setDiscussionLink(ChannelData *link);
[[nodiscard]] ChannelData *discussionLink() const;
[[nodiscard]] bool discussionLinkKnown() const;
void ptsInit(int32 pts) {
_ptsWaiter.init(pts);
@ -570,7 +570,7 @@ private:
std::vector<Data::UnavailableReason> _unavailableReasons;
std::unique_ptr<InvitePeek> _invitePeek;
QString _inviteLink;
std::optional<ChannelData*> _linkedChat;
std::optional<ChannelData*> _discussionLink;
Data::AllowedReactions _allowedReactions;

View file

@ -1044,14 +1044,14 @@ void HistoryItem::setGroupId(MessageGroupId groupId) {
_history->owner().groups().registerMessage(this);
}
bool HistoryItem::checkCommentsLinkedChat(ChannelId id) const {
bool HistoryItem::checkDiscussionLink(ChannelId id) const {
if (!id) {
return true;
} else if (const auto channel = _history->peer->asChannel()) {
if (channel->linkedChatKnown()
if (channel->discussionLinkKnown()
|| !(channel->flags() & ChannelDataFlag::HasLink)) {
const auto linked = channel->linkedChat();
if (!linked || peerToChannel(linked->id) != id) {
const auto link = channel->discussionLink();
if (!link || peerToChannel(link->id) != id) {
return false;
}
}
@ -1154,7 +1154,7 @@ bool HistoryItem::areCommentsUnread() const {
const auto views = Get<HistoryMessageViews>();
if (!views
|| !views->commentsMegagroupId
|| !checkCommentsLinkedChat(views->commentsMegagroupId)) {
|| !checkDiscussionLink(views->commentsMegagroupId)) {
return false;
}
const auto till = views->commentsInboxReadTillId;
@ -3301,7 +3301,7 @@ int HistoryItem::viewsCount() const {
int HistoryItem::repliesCount() const {
if (const auto views = Get<HistoryMessageViews>()) {
if (!checkCommentsLinkedChat(views->commentsMegagroupId)) {
if (!checkDiscussionLink(views->commentsMegagroupId)) {
return 0;
}
return std::max(views->replies.count, 0);
@ -3312,7 +3312,7 @@ int HistoryItem::repliesCount() const {
bool HistoryItem::repliesAreComments() const {
if (const auto views = Get<HistoryMessageViews>()) {
return (views->commentsMegagroupId != 0)
&& checkCommentsLinkedChat(views->commentsMegagroupId);
&& checkDiscussionLink(views->commentsMegagroupId);
}
return false;
}
@ -3805,9 +3805,9 @@ void HistoryItem::createComponents(CreateConfig &&config) {
&& isSending()
&& config.markup.isNull()) {
if (const auto broadcast = _history->peer->asBroadcast()) {
if (const auto linked = broadcast->linkedChat()) {
if (const auto link = broadcast->discussionLink()) {
config.replies.isNull = false;
config.replies.channelId = peerToChannel(linked->id);
config.replies.channelId = peerToChannel(link->id);
}
}
}

View file

@ -597,7 +597,7 @@ private:
return _flags & MessageFlag::Legacy;
}
[[nodiscard]] bool checkCommentsLinkedChat(ChannelId id) const;
[[nodiscard]] bool checkDiscussionLink(ChannelId id) const;
void setReplyMarkup(HistoryMessageMarkupData &&markup);

View file

@ -805,7 +805,7 @@ HistoryWidget::HistoryWidget(
| PeerUpdateFlag::OnlineStatus
| PeerUpdateFlag::Notifications
| PeerUpdateFlag::ChannelAmIn
| PeerUpdateFlag::ChannelLinkedChat
| PeerUpdateFlag::DiscussionLink
| PeerUpdateFlag::Slowmode
| PeerUpdateFlag::BotStartToken
| PeerUpdateFlag::MessagesTTL
@ -877,7 +877,7 @@ HistoryWidget::HistoryWidget(
| PeerUpdateFlag::OnlineStatus
| PeerUpdateFlag::Rights
| PeerUpdateFlag::ChannelAmIn
| PeerUpdateFlag::ChannelLinkedChat)) {
| PeerUpdateFlag::DiscussionLink)) {
handlePeerUpdate();
}
if (flags & PeerUpdateFlag::MessagesTTL) {

View file

@ -572,12 +572,12 @@ infoBlockButton: SettingsButton(infoProfileButton) {
textFg: attentionButtonFg;
textFgOver: attentionButtonFgOver;
}
infoCreateLinkedChatButton: SettingsButton(infoProfileButton) {
infoCreateDiscussionLinkButton: SettingsButton(infoProfileButton) {
padding: margins(74px, 10px, 8px, 8px);
textFg: lightButtonFg;
textFgOver: lightButtonFgOver;
}
infoUnlinkChatButton: SettingsButton(infoCreateLinkedChatButton) {
infoUnlinkDiscussionLinkButton: SettingsButton(infoCreateDiscussionLinkButton) {
textFg: attentionButtonFg;
textFgOver: attentionButtonFgOver;
}

View file

@ -839,7 +839,7 @@ void Filler::addViewDiscussion() {
if (!channel) {
return;
}
const auto chat = channel->linkedChat();
const auto chat = channel->discussionLink();
if (!chat) {
return;
}

View file

@ -2428,7 +2428,7 @@ void SessionController::showPeer(not_null<PeerData*> peer, MsgId msgId) {
if (!clickedChannel->isPublic()
&& !clickedChannel->amIn()
&& (!currentPeer->isChannel()
|| currentPeer->asChannel()->linkedChat()
|| currentPeer->asChannel()->discussionLink()
!= clickedChannel)) {
MainWindowShow(this).showToast(peer->isMegagroup()
? tr::lng_group_not_accessible(tr::now)