diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 8775b85569..344bebd455 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -781,55 +781,11 @@ void InnerWidget::changeOpenedForum(Data::Forum *forum) { } } -void InnerWidget::changeOpenedMonoforum(Data::SavedMessages *monoforum) { - if (_savedSublists == monoforum) { - return; - } - stopReorderPinned(); - clearSelection(); - - if (monoforum) { - saveChatsFilterScrollState(_filterId); - } - _filterId = monoforum - ? 0 - : _controller->activeChatsFilterCurrent(); - if (_openedForum) { - // If we close it inside forum destruction we should not schedule. - session().data().forumIcons().scheduleUserpicsReset(_openedForum); - } - _savedSublists = monoforum; - _st = &st::defaultDialogRow; - refreshShownList(); - - _openedForumLifetime.destroy(); - if (monoforum) { - rpl::merge( - monoforum->chatsListChanges(), - monoforum->chatsListLoadedEvents() - ) | rpl::start_with_next([=] { - refresh(); - }, _openedForumLifetime); - } - - refreshWithCollapsedRows(true); - if (_loadMoreCallback) { - _loadMoreCallback(); - } - - if (!monoforum) { - restoreChatsFilterScrollState(_filterId); - } -} - -void InnerWidget::showSavedSublists(ChannelData *parentChat) { - Expects(!parentChat || parentChat->monoforum()); +void InnerWidget::showSavedSublists() { Expects(!_geometryInited); Expects(!_savedSublists); - _savedSublists = parentChat - ? parentChat->monoforum() - : &session().data().savedMessages(); + _savedSublists = &session().data().savedMessages(); stopReorderPinned(); clearSelection(); diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h index f840a99b43..d2a21405cb 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h @@ -141,8 +141,7 @@ public: void changeOpenedFolder(Data::Folder *folder); void changeOpenedForum(Data::Forum *forum); - void changeOpenedMonoforum(Data::SavedMessages *monoforum); - void showSavedSublists(ChannelData *parentChat); + void showSavedSublists(); void selectSkip(int32 direction); void selectSkipPage(int32 pixels, int32 direction); diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 4ecbf32115..06b1ac9294 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -79,7 +79,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_changes.h" #include "data/data_download_manager.h" #include "data/data_chat_filters.h" -#include "data/data_saved_messages.h" #include "data/data_saved_sublist.h" #include "data/data_stories.h" #include "info/downloads/info_downloads_widget.h" @@ -420,8 +419,6 @@ Widget::Widget( ) | rpl::filter([=](const Data::HistoryUpdate &update) { if (_openedForum) { return (update.history == _openedForum->history()); - } else if (_openedMonoforum) { - return (update.history->peer == _openedMonoforum->parentChat()); } else if (_openedFolder) { return (update.history->folder() == _openedFolder) && !update.history->isPinnedDialog(FilterId()); @@ -600,7 +597,6 @@ Widget::Widget( _search->setFocusFast(); if (_childList) { controller->closeForum(); - controller->closeMonoforum(); } }); @@ -623,8 +619,6 @@ Widget::Widget( searchMore(); } else if (_openedForum && state == WidgetState::Default) { _openedForum->requestTopics(); - } else if (_openedMonoforum && state == WidgetState::Default) { - _openedMonoforum->loadMore(); } else { const auto folder = _inner->shownFolder(); if (!folder || !folder->chatsList()->loaded()) { @@ -673,16 +667,7 @@ Widget::Widget( ) | rpl::filter(!rpl::mappers::_1) | rpl::start_with_next([=] { if (_openedForum) { changeOpenedForum(nullptr, anim::type::normal); - } else if (_childList && !_childList->openedMonoforum()) { - closeChildList(anim::type::normal); - } - }, lifetime()); - - controller->shownMonoforum().changes( - ) | rpl::filter(!rpl::mappers::_1) | rpl::start_with_next([=] { - if (_openedMonoforum) { - changeOpenedMonoforum(nullptr, anim::type::normal); - } else if (_childList && !_childList->openedForum()) { + } else if (_childList) { closeChildList(anim::type::normal); } }, lifetime()); @@ -811,7 +796,7 @@ void Widget::setupSwipeBack() { } }); } - if (controller()->shownForum().current()) { // #TODO monoforum + if (controller()->shownForum().current()) { if (!isRightToLeft) { return Ui::Controls::SwipeHandlerFinishData(); } @@ -932,7 +917,8 @@ void Widget::chosenRow(const ChosenRow &row) { controller()->showForum( forum, Window::SectionShow().withChildColumn()); - if (forum->channel()->viewForumAsMessages()) { + if (controller()->shownForum().current() == forum + && forum->channel()->viewForumAsMessages()) { controller()->showThread( history, ShowAtUnreadMsgId, @@ -940,27 +926,6 @@ void Widget::chosenRow(const ChosenRow &row) { } } return; - //} else if (history - // && history->peer->amMonoforumAdmin() - // && !row.message.fullId) { - // const auto monoforum = history->peer->monoforum(); - // if (controller()->shownMonoforum().current() == monoforum) { - // controller()->closeMonoforum(); - // //} else if (row.newWindow) { // #TODO monoforum - // // controller()->showInNewWindow( - // // Window::SeparateId(Window::SeparateType::Forum, history)); - // } else { - // controller()->showMonoforum( - // monoforum, - // Window::SectionShow().withChildColumn()); - // if (!controller()->adaptive().isOneColumn()) { - // controller()->showThread( - // history, - // ShowAtUnreadMsgId, - // Window::SectionShow::Way::ClearStack); - // } - // } - // return; } else if (history) { const auto peer = history->peer; const auto showAtMsgId = controller()->uniqueChatsInSearchResults() @@ -995,21 +960,6 @@ void Widget::chosenRow(const ChosenRow &row) { } controller()->openFolder(folder); hideChildList(); - } else if (const auto sublist = row.key.sublist()) { - using namespace Window; - auto params = SectionShow(SectionShow::Way::Forward); - params.dropSameFromStack = true; - params.highlightPart.text = _searchState.query; - if (!params.highlightPart.empty()) { - params.highlightPartOffsetHint = kSearchQueryOffsetHint; - } - if (false && row.newWindow) { // #TODO monoforum - controller()->showInNewWindow( - Window::SeparateId(sublist), - row.message.fullId.msg); - } else { - controller()->showThread(sublist, row.message.fullId.msg, params); - } } if (row.filteredRow && !session().supportMode()) { if (_subsectionTopBar) { @@ -1084,8 +1034,7 @@ void Widget::setupTopBarSuggestions(not_null dialogs) { ) | rpl::filter(_1 == nullptr) | rpl::map([=] { auto on = rpl::combine( controller()->activeChatsFilter(), - _openedFolderOrForumOrMonoforumChanges.events_starting_with( - false), + _openedFolderOrForumChanges.events_starting_with(false), widthValue() | rpl::map( _1 >= st::columnMinimalWidthLeft ) | rpl::distinct_until_changed(), @@ -1094,11 +1043,11 @@ void Widget::setupTopBarSuggestions(not_null dialogs) { _jumpToDate->toggledValue() ) | rpl::map([=]( FilterId id, - bool folderOrForumOrMonoforum, + bool folderOrForum, bool wide, bool search, bool searchInPeer) { - return !folderOrForumOrMonoforum + return !folderOrForum && wide && !search && !searchInPeer @@ -1155,8 +1104,7 @@ void Widget::updateFrozenAccountBar() { void Widget::updateTopBarSuggestions() { if (_topBarSuggestion) { - _openedFolderOrForumOrMonoforumChanges.fire( - _openedFolder || _openedForum || _openedMonoforum); + _openedFolderOrForumChanges.fire(_openedFolder || _openedForum); } } @@ -1594,7 +1542,7 @@ void Widget::updateControlsVisibility(bool fast) { if (_chatFilters) { _chatFilters->setVisible(!_openedForum); } - if (_openedFolder || _openedForum || _openedMonoforum) { + if (_openedFolder || _openedForum) { _subsectionTopBar->show(); if (_forumTopShadow) { _forumTopShadow->show(); @@ -1973,29 +1921,6 @@ void Widget::changeOpenedForum(Data::Forum *forum, anim::type animated) { }, (forum != nullptr), animated); } -void Widget::changeOpenedMonoforum( - Data::SavedMessages *monoforum, - anim::type animated) { - if (_openedMonoforum == monoforum) { - return; - } - changeOpenedSubsection([&] { - cancelSearch({ .forceFullCancel = true }); - closeChildList(anim::type::instant); - _openedMonoforum = monoforum; - _searchState.tab = monoforum - ? ChatSearchTab::ThisPeer - : ChatSearchTab::MyMessages; - _searchWithPostsPreview = computeSearchWithPostsPreview(); - _api.request(base::take(_topicSearchRequest)).cancel(); - _inner->changeOpenedMonoforum(monoforum); - storiesToggleExplicitExpand(false); - updateFrozenAccountBar(); - updateTopBarSuggestions(); - updateStoriesVisibility(); - }, (monoforum != nullptr), animated); -} - void Widget::hideChildList() { if (_childList) { controller()->closeForum(); @@ -2003,7 +1928,7 @@ void Widget::hideChildList() { } void Widget::refreshTopBars() { - if (_openedFolder || _openedForum || _openedMonoforum) { + if (_openedFolder || _openedForum) { if (!_subsectionTopBar) { _subsectionTopBar.create(this, controller()); if (_stories) { @@ -2033,12 +1958,10 @@ void Widget::refreshTopBars() { } const auto history = _openedForum ? _openedForum->history().get() - : _openedMonoforum - ? session().data().history(_openedMonoforum->parentChat()).get() : nullptr; _subsectionTopBar->setActiveChat( HistoryView::TopBarWidget::ActiveChat{ - .key = ((_openedForum || _openedMonoforum) + .key = (_openedForum ? Dialogs::Key(history) : Dialogs::Key(_openedFolder)), .section = Dialogs::EntryState::Section::ChatsList, @@ -2204,10 +2127,6 @@ Data::Forum *Widget::openedForum() const { return _openedForum; } -Data::SavedMessages *Widget::openedMonoforum() const { - return _openedMonoforum; -} - void Widget::jumpToTop(bool belowPinned) { if (session().supportMode()) { return; @@ -2506,15 +2425,6 @@ void Widget::escape() { } else if (initial != forum) { controller()->showForum(initial); } - } else if (const auto monoforum - = controller()->shownMonoforum().current()) { - const auto id = controller()->windowId(); // #TODO monoforum - const auto initial = (Data::SavedMessages*)nullptr; - if (!initial) { - controller()->closeMonoforum(); - } else if (initial != monoforum) { - controller()->showMonoforum(initial); - } } else if (controller()->openedFolder().current()) { if (!controller()->windowId().folder()) { controller()->closeFolder(); @@ -3379,33 +3289,12 @@ void Widget::showForum( return; } cancelSearch({ .forceFullCancel = true }); - openChildList(forum, nullptr, params); -} - -void Widget::showMonoforum( - not_null monoforum, - const Window::SectionShow ¶ms) { - if (_openedMonoforum == monoforum) { - return; - } - const auto nochat = !controller()->mainSectionShown(); - if (!params.childColumn - || (Core::App().settings().dialogsWidthRatio(nochat) == 0.) - || (_layout != Layout::Main) - || OptionForumHideChatsList.value()) { - changeOpenedMonoforum(monoforum, params.animated); - return; - } - cancelSearch({ .forceFullCancel = true }); - openChildList(nullptr, monoforum, params); + openChildList(forum, params); } void Widget::openChildList( - Data::Forum *forum, - Data::SavedMessages *monoforum, + not_null forum, const Window::SectionShow ¶ms) { - Expects(forum || monoforum); - auto slide = Window::SectionSlideParams(); const auto animated = !_childList && (params.animated == anim::type::normal); @@ -3426,13 +3315,8 @@ void Widget::openChildList( this, controller(), Layout::Child); - if (forum) { - _childList->showForum(forum, copy); - _childListPeerId = forum->channel()->id; - } else { - _childList->showMonoforum(monoforum, copy); - _childListPeerId = monoforum->parentChat()->id; - } + _childList->showForum(forum, copy); + _childListPeerId = forum->channel()->id; } _childListShadow = std::make_unique(this); @@ -4289,10 +4173,6 @@ PeerData *Widget::searchInPeer() const { ? nullptr : _openedForum ? _openedForum->channel().get() - : _openedMonoforum - ? (_openedMonoforum->parentChat() - ? _openedMonoforum->parentChat() - : (PeerData*)session().user().get()) : _searchState.inChat.sublist() ? _searchState.inChat.sublist()->owningHistory()->peer.get() : _searchState.inChat.peer(); diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.h b/Telegram/SourceFiles/dialogs/dialogs_widget.h index b2584462f2..ab4685101f 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.h @@ -23,7 +23,6 @@ class Error; namespace Data { class Forum; -class SavedMessages; enum class StorySourcesList : uchar; struct ReactionId; } // namespace Data @@ -109,14 +108,10 @@ public: void showForum( not_null forum, const Window::SectionShow ¶ms); - void showMonoforum( - not_null monoforum, - const Window::SectionShow ¶ms); void setInnerFocus(bool unfocusSearch = false); [[nodiscard]] bool searchHasFocus() const; [[nodiscard]] Data::Forum *openedForum() const; - [[nodiscard]] Data::SavedMessages *openedMonoforum() const; void jumpToTop(bool belowPinned = false); void raiseWithTooltip(); @@ -254,9 +249,6 @@ private: anim::type animated); void changeOpenedFolder(Data::Folder *folder, anim::type animated); void changeOpenedForum(Data::Forum *forum, anim::type animated); - void changeOpenedMonoforum( - Data::SavedMessages *monoforum, - anim::type animated); void hideChildList(); void destroyChildListCanvas(); [[nodiscard]] QPixmap grabForFolderSlideAnimation(); @@ -266,8 +258,7 @@ private: Window::SlideDirection direction); void openChildList( - Data::Forum *forum, - Data::SavedMessages *monoforum, + not_null forum, const Window::SectionShow ¶ms); void closeChildList(anim::type animated); @@ -343,7 +334,7 @@ private: Ui::SlideWrap *_topBarSuggestion = nullptr; rpl::event_stream _topBarSuggestionHeightChanged; rpl::event_stream _searchStateForTopBarSuggestion; - rpl::event_stream _openedFolderOrForumOrMonoforumChanges; + rpl::event_stream _openedFolderOrForumChanges; object_ptr _scroll; QPointer _inner; @@ -369,7 +360,6 @@ private: Data::Folder *_openedFolder = nullptr; Data::Forum *_openedForum = nullptr; - Data::SavedMessages *_openedMonoforum = nullptr; SearchState _searchState; History *_searchInMigrated = nullptr; rpl::lifetime _searchTagsLifetime; diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 8273f9604e..3cb26ace66 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -773,10 +773,6 @@ void TopBarWidget::backClicked() { && _activeChat.key.history() && _activeChat.key.history()->isForum()) { _controller->closeForum(); - } else if (_activeChat.section == Section::ChatsList - && _activeChat.key.history() - && _activeChat.key.history()->amMonoforumAdmin()) { - _controller->closeMonoforum(); } else { _controller->showBackFromStack(); } diff --git a/Telegram/SourceFiles/info/saved/info_saved_sublists_widget.cpp b/Telegram/SourceFiles/info/saved/info_saved_sublists_widget.cpp index 0ab5a23af5..06143d2c13 100644 --- a/Telegram/SourceFiles/info/saved/info_saved_sublists_widget.cpp +++ b/Telegram/SourceFiles/info/saved/info_saved_sublists_widget.cpp @@ -58,7 +58,7 @@ SublistsWidget::SublistsWidget( this, controller->parentController(), rpl::single(Dialogs::InnerWidget::ChildListShown()))); - _list->showSavedSublists(nullptr); + _list->showSavedSublists(); _list->setNarrowRatio(0.); _list->chosenRow() | rpl::start_with_next([=](Dialogs::ChosenRow row) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index b759bdcfd4..587172d8f6 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1594,18 +1594,6 @@ void MainWidget::showForum( } } -void MainWidget::showMonoforum( - not_null monoforum, - const SectionShow ¶ms) { - Expects(_dialogs != nullptr); - - _dialogs->showMonoforum(monoforum, params); - - if (params.activation != anim::activation::background) { - _controller->window().hideSettingsAndLayer(); - } -} - PeerData *MainWidget::peer() const { return _history->peer(); } diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 54bb67513c..fc9281f9fe 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -199,9 +199,6 @@ public: not_null item, const SectionShow ¶ms); void showForum(not_null forum, const SectionShow ¶ms); - void showMonoforum( - not_null monoforum, - const SectionShow ¶ms); bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo); diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 6b41f48329..523777e882 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -605,15 +605,10 @@ void SessionNavigation::showPeerByLinkResolved( showPeerInfo(peer, params); } else if (resolveType == ResolveType::HashtagSearch) { searchMessages(info.text, peer->owner().history(peer)); - } else if ((peer->isForum() || peer->amMonoforumAdmin()) - && resolveType != ResolveType::Boost) { + } else if (peer->isForum() && resolveType != ResolveType::Boost) { const auto itemId = info.messageId; if (!itemId) { - if (peer->isForum()) { - parentController()->showForum(peer->forum(), params); - } else { - parentController()->showMonoforum(peer->monoforum(), params); - } + parentController()->showForum(peer->forum(), params); } else if (const auto item = peer->owner().message(peer, itemId)) { showMessageByLinkResolved(item, info); } else { @@ -1929,7 +1924,6 @@ void SessionController::showForum( } }, _shownForumLifetime); content()->showForum(forum, params); - closeMonoforum(); } void SessionController::closeForum() { @@ -1980,57 +1974,6 @@ const rpl::variable &SessionController::shownForum() const { return _shownForum; } -void SessionController::showMonoforum( - not_null monoforum, - const SectionShow ¶ms) { - // if (showForumInDifferentWindow(forum, params)) { - // return; - // } - _shownMonoforumLifetime.destroy(); - if (_shownMonoforum.current() != monoforum) { - resetFakeUnreadWhileOpened(); - } - if (monoforum - && _activeChatEntry.current().key.peer() - && adaptive().isOneColumn()) { - clearSectionStack(params); - } - _shownMonoforum = monoforum.get(); - if (_shownMonoforum.current() != monoforum) { - return; - } - monoforum->destroyed( - ) | rpl::start_with_next([=] { - closeMonoforum(); - }, _shownMonoforumLifetime); - content()->showMonoforum(monoforum, params); - closeForum(); -} - -void SessionController::closeMonoforum() { - if (const auto monoforum = _shownMonoforum.current()) { - const auto id = windowId(); - if (id.type == SeparateType::SavedSublist) { - const auto initial = id.parentChat; - if (!initial - || !initial->monoforum() - || initial == monoforum->parentChat()) { - Core::App().closeWindow(_window); - } else { - showMonoforum(initial->monoforum()); - } - return; - } - } - _shownMonoforumLifetime.destroy(); - _shownMonoforum = nullptr; -} - -auto SessionController::shownMonoforum() const --> const rpl::variable & { - return _shownMonoforum; -} - void SessionController::setActiveChatEntry(Dialogs::RowDescriptor row) { if (windowId().type == SeparateType::SharedMedia) { return; diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index 151fa7de7a..86b1e6f3be 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -415,12 +415,6 @@ public: void closeForum(); const rpl::variable &shownForum() const; - void showMonoforum( - not_null monoforum, - const SectionShow ¶ms = SectionShow::Way::ClearStack); - void closeMonoforum(); - const rpl::variable &shownMonoforum() const; - void setActiveChatEntry(Dialogs::RowDescriptor row); void setActiveChatEntry(Dialogs::Key key); Dialogs::RowDescriptor activeChatEntryCurrent() const; @@ -770,8 +764,6 @@ private: rpl::variable _openedFolder; rpl::variable _shownForum; rpl::lifetime _shownForumLifetime; - rpl::variable _shownMonoforum; - rpl::lifetime _shownMonoforumLifetime; rpl::event_stream<> _filtersMenuChanged; diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 369d8b5172..2b0d129b52 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 369d8b5172b6f70a3a9b2363cfa0f4fc5f620f56 +Subproject commit 2b0d129b528bb56a71ebcf1f8c0a4d8b19123e34