diff --git a/Telegram/SourceFiles/data/data_forum.cpp b/Telegram/SourceFiles/data/data_forum.cpp index 11fb05413f..ae9737e66f 100644 --- a/Telegram/SourceFiles/data/data_forum.cpp +++ b/Telegram/SourceFiles/data/data_forum.cpp @@ -267,16 +267,8 @@ ForumTopic *Forum::topicFor(not_null item) { } ForumTopic *Forum::topicFor(MsgId rootId) { - if (rootId != ForumTopic::kGeneralId) { - if (const auto i = _topics.find(rootId); i != end(_topics)) { - return i->second.get(); - } - } else { - // #TODO lang-forum - applyTopicAdded(rootId, "General! Created.", kGeneralColorId, 0); - return _topics.find(rootId)->second.get(); - } - return nullptr; + const auto i = _topics.find(rootId); + return (i != end(_topics)) ? i->second.get() : nullptr; } rpl::producer<> Forum::chatsListChanges() const { diff --git a/Telegram/SourceFiles/data/data_forum_topic.cpp b/Telegram/SourceFiles/data/data_forum_topic.cpp index b8469436b1..fb9463e0f6 100644 --- a/Telegram/SourceFiles/data/data_forum_topic.cpp +++ b/Telegram/SourceFiles/data/data_forum_topic.cpp @@ -374,9 +374,6 @@ void ForumTopic::requestChatListMessage() { } TimeId ForumTopic::adjustedChatListTimeId() const { - if (isGeneral()) { - return TimeId(1); - } const auto result = chatListTimeId(); #if 0 // #TODO forum draft if (const auto draft = cloudDraft()) { @@ -419,10 +416,10 @@ QString ForumTopic::title() const { } void ForumTopic::applyTitle(const QString &title) { - if (_title == title || (isGeneral() && !_title.isEmpty())) { + if (_title == title) { return; } - _title = isGeneral() ? "General! Topic." : title; // #TODO lang-forum + _title = title; ++_titleVersion; _defaultIcon = QImage(); indexTitleParts(); diff --git a/Telegram/SourceFiles/data/data_forum_topic.h b/Telegram/SourceFiles/data/data_forum_topic.h index dd3ae7760e..8ee4a99df6 100644 --- a/Telegram/SourceFiles/data/data_forum_topic.h +++ b/Telegram/SourceFiles/data/data_forum_topic.h @@ -44,8 +44,6 @@ class Forum; class ForumTopic final : public Dialogs::Entry { public: - static constexpr auto kGeneralId = 1; - ForumTopic(not_null history, MsgId rootId); ~ForumTopic(); @@ -58,9 +56,6 @@ public: [[nodiscard]] not_null forum() const; [[nodiscard]] rpl::producer<> destroyed() const; [[nodiscard]] MsgId rootId() const; - [[nodiscard]] bool isGeneral() const { - return (_rootId == kGeneralId); - } void setRealRootId(MsgId realId); diff --git a/Telegram/SourceFiles/data/data_replies_list.cpp b/Telegram/SourceFiles/data/data_replies_list.cpp index e06bd7474f..5863e59ee4 100644 --- a/Telegram/SourceFiles/data/data_replies_list.cpp +++ b/Telegram/SourceFiles/data/data_replies_list.cpp @@ -228,7 +228,7 @@ void RepliesList::injectRootMessage(not_null viewer) { return; } const auto root = lookupRoot(); - if (!root || root->topicRootId() != Data::ForumTopic::kGeneralId) { + if (!root || root->topicRootId()) { return; } injectRootDivider(root, slice); diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 965619ad82..675c4cc87d 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -1066,10 +1066,7 @@ bool HistoryItem::computeDropForwardedInfo() const { } bool HistoryItem::inThread(MsgId rootId) const { - const auto checkId = (rootId == Data::ForumTopic::kGeneralId) - ? topicRootId() - : replyToTop(); - return (checkId == rootId); + return (replyToTop() == rootId); } not_null HistoryItem::author() const { diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index ca0b084efd..bdde8a8df8 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -216,8 +216,7 @@ MsgId LookupReplyToTop(HistoryItem *replyTo) { } bool LookupReplyIsTopicPost(HistoryItem *replyTo) { - return replyTo - && (replyTo->topicRootId() != Data::ForumTopic::kGeneralId); + return replyTo && (replyTo->topicRootId() != 0); } MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action) { @@ -1490,7 +1489,7 @@ MsgId HistoryMessage::topicRootId() const { ; reply && reply->topicPost) { return reply->replyToTop(); } - return Data::ForumTopic::kGeneralId; + return 0; } void HistoryMessage::setText(const TextWithEntities &textWithEntities) { diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index 2808f229bc..e3e42f1727 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -1310,10 +1310,10 @@ MsgId HistoryService::topicRootId() const { if (const auto data = GetDependentData() ; data && data->topicPost && data->topId) { return data->topId; - } else if (const auto topic = Get()) { + } else if (Has()) { return id; } - return Data::ForumTopic::kGeneralId; + return 0; } void HistoryService::setReplyFields( diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index b82b6fa215..659365fd0a 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -1360,11 +1360,7 @@ void RepliesWidget::refreshTopBarActiveChat() { MsgId RepliesWidget::replyToId() const { const auto custom = _composeControls->replyingToMessage().msg; - return custom - ? custom - : (_rootId == Data::ForumTopic::kGeneralId) - ? MsgId(0) - : _rootId; + return custom ? custom : _rootId; } void RepliesWidget::refreshUnreadCountBadge(std::optional count) { @@ -1577,18 +1573,13 @@ bool RepliesWidget::showMessage( return false; } auto originFound = false; - const auto general = (_rootId == Data::ForumTopic::kGeneralId); const auto originMessage = [&]() -> HistoryItem* { using OriginMessage = Window::SectionShow::OriginMessage; if (const auto origin = std::get_if(¶ms.origin)) { if (const auto returnTo = session().data().message(origin->id)) { if (returnTo->history() != _history) { return nullptr; - } else if (general - && _inner->viewByPosition(returnTo->position()) - && returnTo->replyToId() == messageId) { - return returnTo; - } else if (!general && returnTo->inThread(_rootId)) { + } else if (returnTo->inThread(_rootId)) { return returnTo; } }