2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Allow editing topic title and icon.

This commit is contained in:
John Preston
2022-09-27 16:05:47 +04:00
parent c90f879c96
commit 3b3792ef75
42 changed files with 603 additions and 190 deletions

View File

@@ -54,6 +54,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/empty_userpic.h"
#include "ui/unread_badge.h"
#include "boxes/filters/edit_filter_box.h"
#include "boxes/peers/edit_forum_topic_box.h"
#include "api/api_chat_filters.h"
#include "base/qt/qt_common_adapters.h"
#include "styles/style_dialogs.h"
@@ -2411,7 +2412,8 @@ void InnerWidget::refreshEmptyLabel() {
} else if (_emptyState == EmptyState::EmptyFolder) {
editOpenedFilter();
} else if (_emptyState == EmptyState::EmptyForum) {
Data::ShowAddForumTopic(_controller, _openedForum->channel());
_controller->show(
Box(NewForumTopicBox, _controller, _openedForum->history()));
}
});
_empty->setVisible(_state == WidgetState::Default);
@@ -3287,9 +3289,10 @@ void InnerWidget::setupShortcuts() {
});
request->check(Command::ChatSelf) && request->handle([=] {
if (_openedForum) {
Data::ShowAddForumTopic(
_controller->show(Box(
NewForumTopicBox,
_controller,
_openedForum->channel());
_openedForum->history()));
} else {
_controller->content()->choosePeer(
session().userPeerId(),

View File

@@ -55,8 +55,17 @@ ForumTopic *Key::topic() const {
return _value ? _value->asTopic() : nullptr;
}
History *Key::parentHistory() const {
if (const auto result = history()) {
return result;
} else if (const auto child = topic()) {
return child->forum();
}
return nullptr;
}
PeerData *Key::peer() const {
if (const auto history = this->history()) {
if (const auto history = parentHistory()) {
return history->peer;
}
return nullptr;

View File

@@ -42,6 +42,7 @@ public:
History *history() const;
Data::Folder *folder() const;
Data::ForumTopic *topic() const;
History *parentHistory() const;
PeerData *peer() const;
inline bool operator<(const Key &other) const {

View File

@@ -386,7 +386,9 @@ void Widget::chosenRow(const ChosenRow &row) {
if (const auto topic = row.key.topic()) {
controller()->showRepliesForMessage(
topic->forum(),
topic->rootId());
topic->rootId(),
ShowAtUnreadMsgId,
Window::SectionShow::Way::ClearStack);
} else if (history && history->peer->isForum()) {
controller()->openForum(history->peer->asChannel());
} else if (history) {