2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +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

@@ -25,6 +25,10 @@ ForumTopic::ForumTopic(not_null<History*> forum, MsgId rootId)
, _rootId(rootId) {
}
not_null<ChannelData*> ForumTopic::channel() const {
return _forum->peer->asChannel();
}
not_null<History*> ForumTopic::forum() const {
return _forum;
}
@@ -38,6 +42,11 @@ void ForumTopic::applyTopic(const MTPForumTopic &topic) {
const auto &data = topic.data();
applyTitle(qs(data.vtitle()));
if (const auto iconId = data.vicon_emoji_id()) {
applyIconId(iconId->v);
} else {
applyIconId(0);
}
const auto pinned = _list->pinned();
#if 0 // #TODO forum pinned
@@ -242,6 +251,10 @@ bool ForumTopic::lastServerMessageKnown() const {
return _lastServerMessage.has_value();
}
QString ForumTopic::title() const {
return _title;
}
void ForumTopic::applyTitle(const QString &title) {
if (_title == title || (isGeneral() && !_title.isEmpty())) {
return;
@@ -252,6 +265,15 @@ void ForumTopic::applyTitle(const QString &title) {
updateChatListEntry();
}
DocumentId ForumTopic::iconId() const {
return _iconId;
}
void ForumTopic::applyIconId(DocumentId iconId) {
_iconId = iconId;
updateChatListEntry();
}
void ForumTopic::applyItemAdded(not_null<HistoryItem*> item) {
setLastMessage(item);
}