diff --git a/td/telegram/ForumTopic.cpp b/td/telegram/ForumTopic.cpp index 644651eb7..df0c0878f 100644 --- a/td/telegram/ForumTopic.cpp +++ b/td/telegram/ForumTopic.cpp @@ -8,6 +8,7 @@ #include "td/telegram/DraftMessage.h" #include "td/telegram/ForumTopicInfo.h" +#include "td/telegram/MessagesMAnager.h" #include "td/telegram/ServerMessageId.h" #include "td/telegram/Td.h" @@ -41,18 +42,19 @@ ForumTopic::ForumTopic(Td *td, tl_object_ptr &&forum_t unread_reaction_count_ = forum_topic->unread_reactions_count_; } -td_api::object_ptr ForumTopic::get_forum_topic_object(Td *td, const ForumTopicInfo &info) const { +td_api::object_ptr ForumTopic::get_forum_topic_object(Td *td, DialogId dialog_id, + const ForumTopicInfo &info) const { if (info.is_empty()) { return nullptr; } // TODO draft_message = can_send_message(dialog_id, info_.get_top_thread_message_id()).is_ok() ? ... : nullptr; - // TODO last_message + auto last_message = td->messages_manager_->get_message_object({dialog_id, last_message_id_}, "get_forum_topic_object"); auto draft_message = get_draft_message_object(draft_message_); return td_api::make_object( - info.get_forum_topic_info_object(td), nullptr, is_pinned_, unread_count_, last_read_inbox_message_id_.get(), - last_read_outbox_message_id_.get(), unread_mention_count_, unread_reaction_count_, - get_chat_notification_settings_object(¬ification_settings_), std::move(draft_message)); + info.get_forum_topic_info_object(td), std::move(last_message), is_pinned_, unread_count_, + last_read_inbox_message_id_.get(), last_read_outbox_message_id_.get(), unread_mention_count_, + unread_reaction_count_, get_chat_notification_settings_object(¬ification_settings_), std::move(draft_message)); } } // namespace td diff --git a/td/telegram/ForumTopic.h b/td/telegram/ForumTopic.h index 91ff6c783..fe16fba7b 100644 --- a/td/telegram/ForumTopic.h +++ b/td/telegram/ForumTopic.h @@ -40,7 +40,8 @@ class ForumTopic { return is_short_; } - td_api::object_ptr get_forum_topic_object(Td *td, const ForumTopicInfo &info) const; + td_api::object_ptr get_forum_topic_object(Td *td, DialogId dialog_id, + const ForumTopicInfo &info) const; }; } // namespace td diff --git a/td/telegram/ForumTopicManager.cpp b/td/telegram/ForumTopicManager.cpp index 125a5575d..fb82800b2 100644 --- a/td/telegram/ForumTopicManager.cpp +++ b/td/telegram/ForumTopicManager.cpp @@ -249,7 +249,7 @@ class GetForumTopicQuery final : public Td::ResultHandler { } td_->forum_topic_manager_->on_get_forum_topic_info(DialogId(channel_id_), forum_topic_info, "GetForumTopicQuery"); - return promise_.set_value(forum_topic.get_forum_topic_object(td_, forum_topic_info)); + return promise_.set_value(forum_topic.get_forum_topic_object(td_, DialogId(channel_id_), forum_topic_info)); } default: UNREACHABLE();