@@ -721,7 +721,7 @@ void ForumTopicManager::on_update_pinned_forum_topics(DialogId dialog_id, vector
721721
722722Status ForumTopicManager::set_forum_topic_notification_settings (
723723 DialogId dialog_id, ForumTopicId forum_topic_id,
724- tl_object_ptr <td_api::chatNotificationSettings> &¬ification_settings) {
724+ td_api::object_ptr <td_api::chatNotificationSettings> &¬ification_settings) {
725725 CHECK (!td_->auth_manager_ ->is_bot ());
726726 TRY_STATUS (is_forum (dialog_id, true ));
727727 TRY_STATUS (can_be_forum_topic_id (forum_topic_id));
@@ -758,6 +758,22 @@ bool ForumTopicManager::update_forum_topic_notification_settings(DialogId dialog
758758 return need_update.need_update_server ;
759759}
760760
761+ Status ForumTopicManager::set_forum_topic_draft_message (DialogId dialog_id, ForumTopicId forum_topic_id,
762+ unique_ptr<DraftMessage> &&draft_message) {
763+ TRY_STATUS (is_forum (dialog_id, true ));
764+ TRY_STATUS (can_be_forum_topic_id (forum_topic_id));
765+ auto topic = get_topic (dialog_id, forum_topic_id);
766+ if (topic == nullptr || topic->topic_ == nullptr ) {
767+ return Status::Error (400 , " Topic not found" );
768+ }
769+ if (topic->topic_ ->set_draft_message (std::move (draft_message))) {
770+ save_draft_message (td_, dialog_id, MessageTopic::forum (dialog_id, forum_topic_id),
771+ topic->topic_ ->get_draft_message (), Promise<Unit>());
772+ on_forum_topic_changed (dialog_id, topic);
773+ }
774+ return Status::OK ();
775+ }
776+
761777void ForumTopicManager::get_forum_topic (DialogId dialog_id, ForumTopicId forum_topic_id,
762778 Promise<td_api::object_ptr<td_api::forumTopic>> &&promise) {
763779 TRY_STATUS_PROMISE (promise, is_forum (dialog_id, true ));
0 commit comments