From d42ce87c09c12fbce8d873aa38dd344a41e286e4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 3 Sep 2020 15:53:54 +0400 Subject: [PATCH] Move discussion group link to three-dot menu. --- Telegram/Resources/langs/lang.strings | 7 +- Telegram/SourceFiles/data/data_peer.cpp | 14 ++ Telegram/SourceFiles/data/data_peer.h | 3 + .../history/history_inner_widget.cpp | 21 +-- Telegram/SourceFiles/history/history_item.h | 2 +- .../history/history_item_components.h | 2 +- .../SourceFiles/history/history_message.cpp | 28 +++- .../SourceFiles/history/history_message.h | 2 +- .../SourceFiles/history/history_widget.cpp | 151 +----------------- Telegram/SourceFiles/history/history_widget.h | 4 - .../history/view/history_view_message.cpp | 57 ++++--- .../SourceFiles/window/window_peer_menu.cpp | 12 +- 12 files changed, 95 insertions(+), 208 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 984799c91..4d97e1d2b 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -812,6 +812,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_profile_set_group_photo" = "Set Photo"; "lng_profile_add_participant" = "Add Members"; "lng_profile_view_channel" = "View Channel"; +"lng_profile_view_discussion" = "View discussion"; "lng_profile_join_channel" = "Join Channel"; "lng_profile_join_group" = "Join Group"; "lng_profile_delete_and_exit" = "Leave"; @@ -1330,7 +1331,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_restart_button" = "Restart"; "lng_channel_mute" = "Mute"; "lng_channel_unmute" = "Unmute"; -"lng_channel_discuss" = "Discuss"; "lng_saved_messages" = "Saved Messages"; "lng_saved_short" = "Save"; "lng_saved_forward_here" = "Forward messages here for quick access"; @@ -1350,17 +1350,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_replies_header#one" = "{count} reply"; "lng_replies_header#other" = "{count} replies"; "lng_replies_header_none" = "No replies"; -"lng_replies_send_placeholder" = "Reply"; -"lng_comments_view#one" = "View {count} Comment"; -"lng_comments_view#other" = "View {count} Comments"; -"lng_comments_view_thread" = "Leave a Comment"; "lng_comments_header#one" = "{count} comment"; "lng_comments_header#other" = "{count} comments"; "lng_comments_header_none" = "No comments"; "lng_comments_open_count#one" = "{count} comment"; "lng_comments_open_count#other" = "{count} comments"; "lng_comments_open_none" = "Leave a comment"; -"lng_comments_send_placeholder" = "Comment"; "lng_archived_name" = "Archived chats"; "lng_archived_add" = "Archive"; diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index e25f5d3b6..1ebed16e2 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -613,6 +613,16 @@ const ChannelData *PeerData::asMegagroup() const { : nullptr; } +ChannelData *PeerData::asBroadcast() { + return isBroadcast() ? static_cast(this) : nullptr; +} + +const ChannelData *PeerData::asBroadcast() const { + return isBroadcast() + ? static_cast(this) + : nullptr; +} + ChatData *PeerData::asChatNotMigrated() { if (const auto chat = asChat()) { return chat->migrateTo() ? nullptr : chat; @@ -729,6 +739,10 @@ bool PeerData::isMegagroup() const { return isChannel() ? asChannel()->isMegagroup() : false; } +bool PeerData::isBroadcast() const { + return isChannel() ? asChannel()->isBroadcast() : false; +} + bool PeerData::canWrite() const { if (const auto user = asUser()) { return user->canWrite(); diff --git a/Telegram/SourceFiles/data/data_peer.h b/Telegram/SourceFiles/data/data_peer.h index b4a76b120..d6c992cec 100644 --- a/Telegram/SourceFiles/data/data_peer.h +++ b/Telegram/SourceFiles/data/data_peer.h @@ -158,6 +158,7 @@ public: [[nodiscard]] bool isVerified() const; [[nodiscard]] bool isScam() const; [[nodiscard]] bool isMegagroup() const; + [[nodiscard]] bool isBroadcast() const; [[nodiscard]] bool isNotificationsUser() const { return (id == peerFromUser(333000)) @@ -204,6 +205,8 @@ public: [[nodiscard]] const ChannelData *asChannel() const; [[nodiscard]] ChannelData *asMegagroup(); [[nodiscard]] const ChannelData *asMegagroup() const; + [[nodiscard]] ChannelData *asBroadcast(); + [[nodiscard]] const ChannelData *asBroadcast() const; [[nodiscard]] ChatData *asChatNotMigrated(); [[nodiscard]] const ChatData *asChatNotMigrated() const; [[nodiscard]] ChannelData *asChannelOrMigrated(); diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 66ab48275..78d2e2ed8 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -1540,24 +1540,17 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { _widget->replyToMessage(itemId); }); } - const auto withComments = item->repliesAreComments(); const auto repliesCount = item->repliesCount(); const auto withReplies = IsServerMsgId(item->id) && (repliesCount > 0 || item->replyToTop()); - const auto noBubbleButton = !withComments - || (item->mainView() && !item->mainView()->drawBubble()); - if (withReplies && noBubbleButton) { + if (withReplies && item->history()->peer->isMegagroup()) { const auto rootId = repliesCount ? item->id : item->replyToTop(); - const auto phrase = (item->repliesCount() > 0) - ? (withComments - ? tr::lng_comments_view - : tr::lng_replies_view)( - tr::now, - lt_count, - item->repliesCount()) - : (withComments - ? tr::lng_comments_view_thread - : tr::lng_replies_view_thread)(tr::now); + const auto phrase = (repliesCount > 0) + ? tr::lng_replies_view( + tr::now, + lt_count, + repliesCount) + : tr::lng_replies_view_thread(tr::now); _menu->addAction(phrase, [=] { controller->showRepliesForMessage(_history, rootId); }); diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index b0540d764..ae6508e9c 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -262,7 +262,7 @@ public: } virtual void setReplies(const MTPMessageReplies &data) { } - virtual void changeRepliesCount(int delta, UserId replier) { + virtual void changeRepliesCount(int delta, PeerId replier) { } virtual void setReplyToTop(MsgId replyToTop) { } diff --git a/Telegram/SourceFiles/history/history_item_components.h b/Telegram/SourceFiles/history/history_item_components.h index a2ffb4829..ec5bb6793 100644 --- a/Telegram/SourceFiles/history/history_item_components.h +++ b/Telegram/SourceFiles/history/history_item_components.h @@ -41,7 +41,7 @@ struct HistoryMessageViews : public RuntimeComponent recentRepliers; + std::vector recentRepliers; Part views; Part replies; ChannelId commentsChannelId = 0; diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index f7fc38423..640d480ea 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -927,6 +927,20 @@ void HistoryMessage::createComponents(const CreateConfig &config) { setViewsCount(config.viewsCount); if (config.mtpReplies) { setReplies(*config.mtpReplies); + } else if (isSending()) { + if (const auto broadcast = history()->peer->asBroadcast()) { + if (const auto linked = broadcast->linkedChat()) { + setReplies(MTP_messageReplies( + MTP_flags(MTPDmessageReplies::Flag::f_comments + | MTPDmessageReplies::Flag::f_comments), + MTP_int(0), + MTP_int(0), + MTPVector(), // recent_repliers + MTP_int(linked->bareId()), + MTP_int(0), // max_id + MTP_int(0))); // read_max_id + } + } } } if (const auto edited = Get()) { @@ -1471,11 +1485,11 @@ void HistoryMessage::setReplies(const MTPMessageReplies &data) { views = Get(); } const auto repliers = [&] { - auto result = std::vector(); + auto result = std::vector(); if (const auto list = data.vrecent_repliers()) { result.reserve(list->v.size()); for (const auto &id : list->v) { - result.push_back(id.v); + result.push_back(peerFromMTP(id)); } } return result; @@ -1525,7 +1539,7 @@ void HistoryMessage::refreshRepliesText( } } -void HistoryMessage::changeRepliesCount(int delta, UserId replier) { +void HistoryMessage::changeRepliesCount(int delta, PeerId replier) { const auto views = Get(); const auto limit = HistoryMessageViews::kMaxRecentRepliers; if (!views || views->replies.count < 0) { @@ -1596,12 +1610,10 @@ void HistoryMessage::changeReplyToTopCounter( } const auto changeFor = [&](not_null item) { if (const auto from = displayFrom()) { - if (const auto user = from->asUser()) { - item->changeRepliesCount(delta, user->bareId()); - return; - } + item->changeRepliesCount(delta, from->id); + return; } - item->changeRepliesCount(delta, UserId()); + item->changeRepliesCount(delta, PeerId()); }; if (const auto views = top->Get()) { if (views->commentsChannelId) { diff --git a/Telegram/SourceFiles/history/history_message.h b/Telegram/SourceFiles/history/history_message.h index 1acc39575..cad3ef2da 100644 --- a/Telegram/SourceFiles/history/history_message.h +++ b/Telegram/SourceFiles/history/history_message.h @@ -135,7 +135,7 @@ public: void setViewsCount(int count) override; void setForwardsCount(int count) override; void setReplies(const MTPMessageReplies &data) override; - void changeRepliesCount(int delta, UserId replier) override; + void changeRepliesCount(int delta, PeerId replier) override; void setReplyToTop(MsgId replyToTop) override; void setRealId(MsgId newId) override; void incrementReplyToTopCounter() override; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index ae4fe685d..46ffd69aa 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -139,101 +139,6 @@ constexpr auto kCommonModifiers = 0 | Qt::ControlModifier; const auto kPsaAboutPrefix = "cloud_lng_about_psa_"; -object_ptr SetupDiscussButton( - not_null parent, - not_null controller) { - auto result = object_ptr( - parent, - QString(), - st::historyComposeButton); - const auto button = result.data(); - const auto label = Ui::CreateChild( - button, - tr::lng_channel_discuss() | Ui::Text::ToUpper(), - st::historyComposeButtonLabel); - const auto badge = Ui::CreateChild(button); - label->show(); - - controller->activeChatValue( - ) | rpl::map([=](Dialogs::Key chat) { - return chat.history(); - }) | rpl::map([=](History *history) { - return history ? history->peer->asChannel() : nullptr; - }) | rpl::map([=](ChannelData *channel) -> rpl::producer { - if (channel && channel->isBroadcast()) { - return channel->session().changes().peerFlagsValue( - channel, - Data::PeerUpdate::Flag::ChannelLinkedChat - ) | rpl::map([=] { - return channel->linkedChat(); - }); - } - return rpl::single(nullptr); - }) | rpl::flatten_latest( - ) | rpl::distinct_until_changed( - ) | rpl::map([=](ChannelData *chat) - -> rpl::producer> { - if (chat) { - using UpdateFlag = Data::PeerUpdate::Flag; - return rpl::merge( - chat->session().changes().historyUpdates( - Data::HistoryUpdate::Flag::UnreadView - ) | rpl::filter([=](const Data::HistoryUpdate &update) { - return (update.history->peer == chat); - }) | rpl::to_empty, - - chat->session().changes().peerFlagsValue( - chat, - UpdateFlag::Notifications | UpdateFlag::ChannelAmIn - ) | rpl::to_empty - ) | rpl::map([=] { - const auto history = chat->amIn() - ? chat->owner().historyLoaded(chat) - : nullptr; - return history - ? std::make_tuple( - history->unreadCountForBadge(), - !history->mute()) - : std::make_tuple(0, false); - }); - } else { - return rpl::single(std::make_tuple(0, false)); - } - }) | rpl::flatten_latest( - ) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](int count, bool active) { - badge->setText(QString::number(count), active); - badge->setVisible(count > 0); - }, badge->lifetime()); - - rpl::combine( - badge->shownValue(), - badge->widthValue(), - label->widthValue(), - button->widthValue() - ) | rpl::start_with_next([=]( - bool badgeShown, - int badgeWidth, - int labelWidth, - int width) { - const auto textTop = st::historyComposeButton.textTop; - const auto badgeTop = textTop - + st::historyComposeButton.font->height - - badge->textBaseline(); - const auto add = badgeShown - ? (textTop + badgeWidth) - : 0; - const auto total = labelWidth + add; - label->moveToLeft((width - total) / 2, textTop, width); - badge->moveToRight((width - total) / 2, textTop, width); - }, button->lifetime()); - - label->setAttribute(Qt::WA_TransparentForMouseEvents); - badge->setAttribute(Qt::WA_TransparentForMouseEvents); - - return result; -} - void ShowErrorToast(const QString &text) { Ui::Toast::Show(Ui::Toast::Config{ .text = { text }, @@ -278,7 +183,6 @@ HistoryWidget::HistoryWidget( this, tr::lng_channel_mute(tr::now).toUpper(), st::historyComposeButton) -, _discuss(SetupDiscussButton(this, controller)) , _attachToggle(this, st::historyAttach) , _tabbedSelectorToggle(this, st::historyAttachEmoji) , _botKeyboardShow(this, st::historyBotKeyboardShow) @@ -318,7 +222,6 @@ HistoryWidget::HistoryWidget( _botStart->addClickHandler([=] { sendBotStartCommand(); }); _joinChannel->addClickHandler([=] { joinChannel(); }); _muteUnmute->addClickHandler([=] { toggleMuteUnmute(); }); - _discuss->addClickHandler([=] { goToDiscussionGroup(); }); connect( _field, &Ui::InputField::submitted, @@ -448,7 +351,6 @@ HistoryWidget::HistoryWidget( _botStart->hide(); _joinChannel->hide(); _muteUnmute->hide(); - _discuss->hide(); _send->setRecordStartCallback([this] { recordStartCallback(); }); _send->setRecordStopCallback([this](bool active) { recordStopCallback(active); }); @@ -2140,7 +2042,6 @@ void HistoryWidget::updateControlsVisibility() { if (isBlocked()) { _joinChannel->hide(); _muteUnmute->hide(); - _discuss->hide(); _botStart->hide(); if (_unblock->isHidden()) { _unblock->clearState(); @@ -2149,7 +2050,6 @@ void HistoryWidget::updateControlsVisibility() { } else if (isJoinChannel()) { _unblock->hide(); _muteUnmute->hide(); - _discuss->hide(); _botStart->hide(); if (_joinChannel->isHidden()) { _joinChannel->clearState(); @@ -2163,19 +2063,10 @@ void HistoryWidget::updateControlsVisibility() { _muteUnmute->clearState(); _muteUnmute->show(); } - if (hasDiscussionGroup()) { - if (_discuss->isHidden()) { - _discuss->clearState(); - _discuss->show(); - } - } else { - _discuss->hide(); - } } else if (isBotStart()) { _unblock->hide(); _joinChannel->hide(); _muteUnmute->hide(); - _discuss->hide(); if (_botStart->isHidden()) { _botStart->clearState(); _botStart->show(); @@ -2217,7 +2108,6 @@ void HistoryWidget::updateControlsVisibility() { _botStart->hide(); _joinChannel->hide(); _muteUnmute->hide(); - _discuss->hide(); _send->show(); updateSendButtonType(); if (_recording) { @@ -2296,7 +2186,6 @@ void HistoryWidget::updateControlsVisibility() { _botStart->hide(); _joinChannel->hide(); _muteUnmute->hide(); - _discuss->hide(); _attachToggle->hide(); if (_silent) { _silent->hide(); @@ -3242,22 +3131,6 @@ void HistoryWidget::toggleMuteUnmute() { session().data().updateNotifySettings(_peer, muteForSeconds); } -void HistoryWidget::goToDiscussionGroup() { - const auto channel = _peer ? _peer->asChannel() : nullptr; - const auto chat = channel ? channel->linkedChat() : nullptr; - if (!chat) { - return; - } - controller()->showPeerHistory(chat, Window::SectionShow::Way::Forward); -} - -bool HistoryWidget::hasDiscussionGroup() const { - const auto channel = _peer ? _peer->asChannel() : nullptr; - return channel - && channel->isBroadcast() - && (channel->flags() & MTPDchannel::Flag::f_has_link); -} - void HistoryWidget::onBroadcastSilentChange() { updateFieldPlaceholder(); } @@ -4033,7 +3906,7 @@ void HistoryWidget::moveFieldControls() { // _attachToggle --------- _inlineResults -------------------------------------- _tabbedPanel --------- _fieldBarCancel // (_attachDocument|_attachPhoto) _field (_scheduled) (_silent|_cmdStart|_kbShow) (_kbHide|_tabbedSelectorToggle) _send -// (_botStart|_unblock|_joinChannel|{_muteUnmute&_discuss}) +// (_botStart|_unblock|_joinChannel|_muteUnmute) auto buttonsBottom = bottom - _attachToggle->height(); auto left = 0; @@ -4073,20 +3946,7 @@ void HistoryWidget::moveFieldControls() { _unblock->setGeometry(fullWidthButtonRect); _joinChannel->setGeometry(fullWidthButtonRect); - if (hasDiscussionGroup()) { - _muteUnmute->setGeometry(myrtlrect( - 0, - fullWidthButtonRect.y(), - width() / 2, - fullWidthButtonRect.height())); - _discuss->setGeometry(myrtlrect( - width() / 2, - fullWidthButtonRect.y(), - width() - (width() / 2), - fullWidthButtonRect.height())); - } else { - _muteUnmute->setGeometry(fullWidthButtonRect); - } + _muteUnmute->setGeometry(fullWidthButtonRect); } void HistoryWidget::updateFieldSize() { @@ -4458,7 +4318,6 @@ void HistoryWidget::handleHistoryChange(not_null history) { const auto botStart = isBotStart(); const auto joinChannel = isJoinChannel(); const auto muteUnmute = isMuteUnmute(); - const auto discuss = muteUnmute && hasDiscussionGroup(); const auto update = false || (_unblock->isHidden() == unblock) || (!unblock && _botStart->isHidden() == botStart) @@ -4468,8 +4327,7 @@ void HistoryWidget::handleHistoryChange(not_null history) { || (!unblock && !botStart && !joinChannel - && (_muteUnmute->isHidden() == muteUnmute - || _discuss->isHidden() == discuss)); + && _muteUnmute->isHidden() == muteUnmute); if (update) { updateControlsVisibility(); updateControlsGeometry(); @@ -5999,8 +5857,7 @@ void HistoryWidget::handlePeerUpdate() { } if (!_a_show.animating()) { if (_unblock->isHidden() == isBlocked() - || (!isBlocked() && _joinChannel->isHidden() == isJoinChannel()) - || (isMuteUnmute() && _discuss->isHidden() == hasDiscussionGroup())) { + || (!isBlocked() && _joinChannel->isHidden() == isJoinChannel())) { resize = true; } bool newCanSendMessages = _peer->canWrite(); diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index e945bf72b..934c907a0 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -397,9 +397,6 @@ private: void unblockUser(); void sendBotStartCommand(); void joinChannel(); - void goToDiscussionGroup(); - - [[nodiscard]] bool hasDiscussionGroup() const; void supportInitAutocomplete(); void supportInsertText(const QString &text); @@ -694,7 +691,6 @@ private: object_ptr _botStart; object_ptr _joinChannel; object_ptr _muteUnmute; - object_ptr _discuss; object_ptr _attachToggle; object_ptr _tabbedSelectorToggle; object_ptr _botKeyboardShow; diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index e25e4a799..e598b4d13 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -192,7 +192,7 @@ style::color FromNameFg(PeerId peerId, bool selected) { struct Message::CommentsButton { struct Userpic { - not_null user; + not_null peer; std::shared_ptr view; InMemoryKey uniqueKey; }; @@ -636,11 +636,11 @@ void Message::paintCommentsButton( } for (auto i = 0; i != count; ++i) { auto &entry = list[i]; - const auto user = entry.user; + const auto peer = entry.peer; auto &view = entry.view; const auto wasView = view.get(); - if (views->recentRepliers[i] != user->bareId() - || user->userpicUniqueKey(view) != entry.uniqueKey + if (views->recentRepliers[i] != peer->id + || peer->userpicUniqueKey(view) != entry.uniqueKey || view.get() != wasView) { return true; } @@ -649,13 +649,13 @@ void Message::paintCommentsButton( }(); if (regenerate) { for (auto i = 0; i != count; ++i) { - const auto userId = views->recentRepliers[i]; + const auto peerId = views->recentRepliers[i]; if (i == list.size()) { list.push_back(CommentsButton::Userpic{ - history()->owner().user(userId) + history()->owner().peer(peerId) }); - } else if (list[i].user->bareId() != userId) { - list[i].user = history()->owner().user(userId); + } else if (list[i].peer->id != peerId) { + list[i].peer = history()->owner().peer(peerId); } } while (list.size() > count) { @@ -678,8 +678,8 @@ void Message::paintCommentsButton( for (auto i = count; i != 0;) { auto &entry = list[--i]; q.setCompositionMode(QPainter::CompositionMode_SourceOver); - entry.user->paintUserpic(q, entry.view, x, 0, single); - entry.uniqueKey = entry.user->userpicUniqueKey(entry.view); + entry.peer->paintUserpic(q, entry.view, x, 0, single); + entry.uniqueKey = entry.peer->userpicUniqueKey(entry.view); q.setCompositionMode(QPainter::CompositionMode_Source); q.drawEllipse(x, 0, single, single); x -= single - shift; @@ -1183,23 +1183,29 @@ bool Message::getStateCommentsButton( return false; } g.setHeight(g.height() - st::historyCommentsButtonHeight); - if (QRect(g.left(), g.top() + g.height(), g.width(), st::historyCommentsButtonHeight).contains(point)) { - if (!_comments->link) { - const auto fullId = data()->fullId(); - _comments->link = std::make_shared([=] { - if (const auto window = App::wnd()) { - if (const auto controller = window->sessionController()) { - if (const auto item = controller->session().data().message(fullId)) { - controller->showRepliesForMessage(item->history(), item->id); - } + if (data()->isSending() + || !QRect( + g.left(), + g.top() + g.height(), + g.width(), + st::historyCommentsButtonHeight).contains(point)) { + return false; + } + if (!_comments->link) { + const auto fullId = data()->fullId(); + _comments->link = std::make_shared([=] { + if (const auto window = App::wnd()) { + if (const auto controller = window->sessionController()) { + if (const auto item = controller->session().data().message(fullId)) { + controller->showRepliesForMessage(item->history(), item->id); } } - }); - } - outResult->link = _comments->link; - _comments->lastPoint = point - QPoint(g.left(), g.top() + g.height()); + } + }); } - return false; + outResult->link = _comments->link; + _comments->lastPoint = point - QPoint(g.left(), g.top() + g.height()); + return true; } bool Message::getStateFromName( @@ -1760,6 +1766,9 @@ void Message::refreshDataIdHook() { if (base::take(_fastReplyLink)) { _fastReplyLink = fastReplyLink(); } + if (_comments) { + _comments->link = nullptr; + } } int Message::timeLeft() const { diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 4310ab1ee..4df09228e 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -547,13 +547,21 @@ void Filler::addChannelActions(not_null channel) { // } //} if (_source != PeerMenuSource::ChatsList) { + if (channel->isBroadcast()) { + if (const auto chat = channel->linkedChat()) { + _addAction(tr::lng_profile_view_discussion(tr::now), [=] { + navigation->showPeerHistory( + chat, + Window::SectionShow::Way::Forward); + }); + } + } if (EditPeerInfoBox::Available(channel)) { - const auto controller = _controller; const auto text = isGroup ? tr::lng_manage_group_title(tr::now) : tr::lng_manage_channel_title(tr::now); _addAction(text, [=] { - controller->showEditPeerBox(channel); + navigation->showEditPeerBox(channel); }); } if (channel->canAddMembers()) {