Add "View as Messages" in forums.

This commit is contained in:
John Preston 2022-10-18 16:37:51 +04:00
parent 9ddbc75638
commit fcc4503791
2 changed files with 15 additions and 0 deletions

View file

@ -3511,6 +3511,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_forum_no_topics" = "No topics currently created in this forum.";
"lng_forum_create_topic" = "Create topic";
"lng_forum_discard_sure" = "Discard sure?";
"lng_forum_view_as_messages" = "View as Messages";
// Wnd specific

View file

@ -237,6 +237,7 @@ private:
void addTTLSubmenu(bool addSeparator);
void addGiftPremium();
void addCreateTopic();
void addViewAsMessages();
void addSearchTopics();
not_null<SessionController*> _controller;
@ -948,6 +949,18 @@ void Filler::addCreateTopic() {
_addAction(PeerMenuCallback::Args{ .isSeparator = true });
}
void Filler::addViewAsMessages() {
if (!_peer || !_peer->isForum()) {
return;
}
const auto peer = _peer;
const auto controller = _controller;
_addAction(tr::lng_forum_view_as_messages(tr::now), [=] {
controller->showPeerHistory(peer->id);
}, &st::menuIconViewReplies);
_addAction(PeerMenuCallback::Args{ .isSeparator = true });
}
void Filler::addSearchTopics() {
_addAction(tr::lng_dlg_filter(tr::now), [=] {
@ -959,6 +972,7 @@ void Filler::fillChatsListActions() {
return;
}
addCreateTopic();
addViewAsMessages();
addInfo();
addNewMembers();
const auto &all = _peer->forum()->topicsList()->indexed()->all();