mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 05:58:38 +00:00
Fix new forum layout search and topics list.
This commit is contained in:
parent
08681ac1b9
commit
65cfd6c81c
@ -3516,7 +3516,10 @@ bool Widget::applySearchState(SearchState state) {
|
|||||||
showSearchInTopBar(anim::type::normal);
|
showSearchInTopBar(anim::type::normal);
|
||||||
} else if (_layout == Layout::Main) {
|
} else if (_layout == Layout::Main) {
|
||||||
_forumSearchRequested = true;
|
_forumSearchRequested = true;
|
||||||
controller()->showForum(forum);
|
auto params = Window::SectionShow(
|
||||||
|
Window::SectionShow::Way::ClearStack);
|
||||||
|
params.forceTopicsList = true;
|
||||||
|
controller()->showForum(forum, params);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -4345,6 +4348,19 @@ bool Widget::cancelSearch(CancelSearchOptions options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateForceDisplayWide();
|
updateForceDisplayWide();
|
||||||
|
if (clearingInChat) {
|
||||||
|
if (const auto forum = controller()->shownForum().current()) {
|
||||||
|
if (forum->channel()->useSubsectionTabs()) {
|
||||||
|
const auto id = controller()->windowId();
|
||||||
|
const auto initial = id.forum();
|
||||||
|
if (!initial) {
|
||||||
|
controller()->closeForum();
|
||||||
|
} else if (initial != forum) {
|
||||||
|
controller()->showForum(initial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return clearingQuery || clearingInChat || clearSearchFocus;
|
return clearingQuery || clearingInChat || clearSearchFocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
#include "data/data_folder.h"
|
#include "data/data_folder.h"
|
||||||
|
#include "data/data_forum.h"
|
||||||
#include "data/data_forum_topic.h"
|
#include "data/data_forum_topic.h"
|
||||||
#include "data/data_peer_values.h"
|
#include "data/data_peer_values.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
@ -1040,6 +1041,9 @@ private:
|
|||||||
not_null<ChannelData*> channel);
|
not_null<ChannelData*> channel);
|
||||||
Ui::MultiSlideTracker fillDiscussionButtons(
|
Ui::MultiSlideTracker fillDiscussionButtons(
|
||||||
not_null<ChannelData*> channel);
|
not_null<ChannelData*> channel);
|
||||||
|
void addShowTopicsListButton(
|
||||||
|
Ui::MultiSlideTracker &tracker,
|
||||||
|
not_null<Data::Forum*> forum);
|
||||||
|
|
||||||
void addReportReaction(Ui::MultiSlideTracker &tracker);
|
void addReportReaction(Ui::MultiSlideTracker &tracker);
|
||||||
void addReportReaction(
|
void addReportReaction(
|
||||||
@ -2103,23 +2107,37 @@ void DetailsFiller::addReportReaction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ui::MultiSlideTracker DetailsFiller::fillTopicButtons() {
|
Ui::MultiSlideTracker DetailsFiller::fillTopicButtons() {
|
||||||
|
Ui::MultiSlideTracker tracker;
|
||||||
|
addShowTopicsListButton(tracker, _topic->forum());
|
||||||
|
return tracker;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DetailsFiller::addShowTopicsListButton(
|
||||||
|
Ui::MultiSlideTracker &tracker,
|
||||||
|
not_null<Data::Forum*> forum) {
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
|
|
||||||
Ui::MultiSlideTracker tracker;
|
|
||||||
const auto window = _controller->parentController();
|
const auto window = _controller->parentController();
|
||||||
|
const auto channel = forum->channel();
|
||||||
const auto forum = _topic->forum();
|
|
||||||
auto showTopicsVisible = rpl::combine(
|
auto showTopicsVisible = rpl::combine(
|
||||||
window->adaptive().oneColumnValue(),
|
window->adaptive().oneColumnValue(),
|
||||||
window->shownForum().value(),
|
window->shownForum().value(),
|
||||||
_1 || (_2 != forum));
|
_1 || (_2 != forum));
|
||||||
|
const auto callback = [=] {
|
||||||
|
if (const auto forum = channel->forum()) {
|
||||||
|
if (channel->useSubsectionTabs()) {
|
||||||
|
window->searchInChat(forum->history());
|
||||||
|
} else {
|
||||||
|
window->showForum(forum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
AddMainButton(
|
AddMainButton(
|
||||||
_wrap,
|
_wrap,
|
||||||
tr::lng_forum_show_topics_list(),
|
tr::lng_forum_show_topics_list(),
|
||||||
std::move(showTopicsVisible),
|
std::move(showTopicsVisible),
|
||||||
[=] { window->showForum(forum); },
|
callback,
|
||||||
tracker);
|
tracker);
|
||||||
return tracker;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::MultiSlideTracker DetailsFiller::fillUserButtons(
|
Ui::MultiSlideTracker DetailsFiller::fillUserButtons(
|
||||||
@ -2216,6 +2234,12 @@ Ui::MultiSlideTracker DetailsFiller::fillDiscussionButtons(
|
|||||||
std::move(viewDiscussion),
|
std::move(viewDiscussion),
|
||||||
tracker);
|
tracker);
|
||||||
|
|
||||||
|
if (const auto forum = channel->forum()) {
|
||||||
|
if (channel->useSubsectionTabs()) {
|
||||||
|
addShowTopicsListButton(tracker, forum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return tracker;
|
return tracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1876,9 +1876,10 @@ bool SessionController::showForumInDifferentWindow(
|
|||||||
void SessionController::showForum(
|
void SessionController::showForum(
|
||||||
not_null<Data::Forum*> forum,
|
not_null<Data::Forum*> forum,
|
||||||
const SectionShow ¶ms) {
|
const SectionShow ¶ms) {
|
||||||
|
const auto forced = params.forceTopicsList;
|
||||||
if (showForumInDifferentWindow(forum, params)) {
|
if (showForumInDifferentWindow(forum, params)) {
|
||||||
return;
|
return;
|
||||||
} else if (forum->channel()->useSubsectionTabs()) {
|
} else if (!forced && forum->channel()->useSubsectionTabs()) {
|
||||||
if (const auto active = forum->activeSubsectionThread()) {
|
if (const auto active = forum->activeSubsectionThread()) {
|
||||||
showThread(active, ShowAtUnreadMsgId, params);
|
showThread(active, ShowAtUnreadMsgId, params);
|
||||||
} else {
|
} else {
|
||||||
@ -1914,10 +1915,16 @@ void SessionController::showForum(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
content()->showForum(forum, params);
|
||||||
|
if (_shownForum.current() != forum) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
forum->destroyed(
|
forum->destroyed(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
closeAndShowHistory(false);
|
closeAndShowHistory(false);
|
||||||
}, _shownForumLifetime);
|
}, _shownForumLifetime);
|
||||||
|
if (!forced) {
|
||||||
using FlagChange = Data::Flags<ChannelDataFlags>::Change;
|
using FlagChange = Data::Flags<ChannelDataFlags>::Change;
|
||||||
forum->channel()->flagsValue(
|
forum->channel()->flagsValue(
|
||||||
) | rpl::start_with_next([=](FlagChange change) {
|
) | rpl::start_with_next([=](FlagChange change) {
|
||||||
@ -1927,7 +1934,7 @@ void SessionController::showForum(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _shownForumLifetime);
|
}, _shownForumLifetime);
|
||||||
content()->showForum(forum, params);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionController::closeForum() {
|
void SessionController::closeForum() {
|
||||||
|
@ -171,6 +171,7 @@ struct SectionShow {
|
|||||||
bool thirdColumn = false;
|
bool thirdColumn = false;
|
||||||
bool childColumn = false;
|
bool childColumn = false;
|
||||||
bool forbidLayer = false;
|
bool forbidLayer = false;
|
||||||
|
bool forceTopicsList = false;
|
||||||
bool reapplyLocalDraft = false;
|
bool reapplyLocalDraft = false;
|
||||||
bool dropSameFromStack = false;
|
bool dropSameFromStack = false;
|
||||||
Origin origin;
|
Origin origin;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user