diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 877674edd9..37b72d4b3b 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1491,6 +1491,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_profile_hide_participants_about" = "Switch this on to hide the list of members in this group. Admins will remain visible."; "lng_profile_view_channel" = "View Channel"; "lng_profile_view_discussion" = "View discussion"; +"lng_profile_direct_messages" = "Direct messages"; "lng_profile_join_channel" = "Join Channel"; "lng_profile_join_group" = "Join Group"; "lng_profile_apply_to_join_group" = "Apply to Join Group"; diff --git a/Telegram/SourceFiles/data/data_saved_sublist.cpp b/Telegram/SourceFiles/data/data_saved_sublist.cpp index ce0a3f4147..594a1d1935 100644 --- a/Telegram/SourceFiles/data/data_saved_sublist.cpp +++ b/Telegram/SourceFiles/data/data_saved_sublist.cpp @@ -445,7 +445,6 @@ void SavedSublist::setInboxReadTill( && _inboxReadTillId >= _list.front()) { unreadCount = 0; } - const auto wasUnreadCount = _unreadCount; if (_unreadCount.current() != unreadCount && (changed || unreadCount.has_value())) { setUnreadCount(unreadCount); @@ -593,24 +592,7 @@ std::optional SavedSublist::computeUnreadCountLocally( } void SavedSublist::requestUnreadCount() { - if (_reloadUnreadCountRequestId) { - return; - } - //const auto weak = base::make_weak(this); // #TODO monoforum - //const auto session = &_parent->session(); - //const auto apply = [weak](MsgId readTill, int unreadCount) { - // if (const auto strong = weak.get()) { - // strong->setInboxReadTill(readTill, unreadCount); - // } - //}; - //_reloadUnreadCountRequestId = session->api().request( - // ... - //).done([=](const ... &result) { - // if (weak) { - // _reloadUnreadCountRequestId = 0; - // } - // ... - //}).send(); + parent()->requestSublist(sublistPeer()); } void SavedSublist::readTill(not_null item) { diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 6a902916eb..8be1249d40 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -2188,24 +2188,6 @@ Ui::MultiSlideTracker DetailsFiller::fillChannelButtons( std::move(viewChannel), tracker); - auto viewDirectVisible = channel->flagsValue() | rpl::map([=] { - return channel->monoforumLink() != nullptr; - }) | rpl::distinct_until_changed(); - auto viewDirect = [=] { - if (const auto linked = channel->monoforumLink()) { - window->showPeerHistory(linked); - //if (const auto monoforum = linked->monoforum()) { - // window->showMonoforum(monoforum); - //} - } - }; - AddMainButton( // #TODO monoforum - _wrap, - rpl::single(u"View Direct Messages"_q), - std::move(viewDirectVisible), - std::move(viewDirect), - tracker); - return tracker; } diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index fc68d80a5a..2a5da8ae11 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -293,6 +293,7 @@ private: void addThemeEdit(); void addBlockUser(); void addViewDiscussion(); + void addDirectMessages(); void addToggleTopicClosed(); void addExportChat(); void addTranslate(); @@ -872,6 +873,23 @@ void Filler::addViewDiscussion() { }, &st::menuIconDiscussion); } +void Filler::addDirectMessages() { + const auto channel = _peer->asBroadcast(); + if (!channel) { + return; + } + const auto monoforum = channel->broadcastMonoforum(); + if (!monoforum || !monoforum->amMonoforumAdmin()) { + return; + } + const auto navigation = _controller; + _addAction(tr::lng_profile_direct_messages(tr::now), [=] { + navigation->showPeerHistory( + monoforum, + Window::SectionShow::Way::Forward); + }, &st::menuIconChatDiscuss); +} + void Filler::addExportChat() { if (_thread->asTopic() || !_peer->canExportChatHistory()) { return; @@ -1461,6 +1479,7 @@ void Filler::fillHistoryActions() { addCreatePoll(); addThemeEdit(); addViewDiscussion(); + addDirectMessages(); addExportChat(); addTranslate(); addReport(); @@ -1485,6 +1504,7 @@ void Filler::fillProfileActions() { addManageTopic(); addToggleTopicClosed(); addViewDiscussion(); + addDirectMessages(); addExportChat(); addToggleFolder(); addBlockUser();