Add updateForumTopicInfo.

This commit is contained in:
levlam 2022-10-28 00:12:44 +03:00
parent 090d2b4bc3
commit d6482525b3
3 changed files with 22 additions and 1 deletions

View File

@ -4439,6 +4439,9 @@ updateChatFilters chat_filters:vector<chatFilterInfo> main_chat_list_position:in
//@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. There is no guarantee that it will be sent just after the number of online users has changed @chat_id Identifier of the chat @online_member_count New number of online members in the chat, or 0 if unknown //@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. There is no guarantee that it will be sent just after the number of online users has changed @chat_id Identifier of the chat @online_member_count New number of online members in the chat, or 0 if unknown
updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update; updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update;
//@description Basic information about a topic in a forum chat was changed @chat_id Chat identifier @info New information about the topic
updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update;
//@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings
updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update;

View File

@ -267,7 +267,9 @@ void ForumTopicManager::on_forum_topic_edited(DialogId dialog_id, MessageId top_
if (topic_info == nullptr) { if (topic_info == nullptr) {
return; return;
} }
topic_info->apply_edited_data(edited_data); if (topic_info->apply_edited_data(edited_data)) {
send_update_forum_topic_info(dialog_id, topic_info);
}
} }
Status ForumTopicManager::is_forum(DialogId dialog_id) { Status ForumTopicManager::is_forum(DialogId dialog_id) {
@ -296,6 +298,7 @@ ForumTopicInfo *ForumTopicManager::add_topic_info(DialogId dialog_id, unique_ptr
dialog_info->topic_infos_.set(top_thread_message_id, std::move(forum_topic_info)); dialog_info->topic_infos_.set(top_thread_message_id, std::move(forum_topic_info));
topic_info = get_topic_info(dialog_id, top_thread_message_id); topic_info = get_topic_info(dialog_id, top_thread_message_id);
CHECK(topic_info != nullptr); CHECK(topic_info != nullptr);
send_update_forum_topic_info(dialog_id, topic_info);
} }
return topic_info; return topic_info;
} }
@ -316,4 +319,14 @@ const ForumTopicInfo *ForumTopicManager::get_topic_info(DialogId dialog_id, Mess
return dialog_info->topic_infos_.get_pointer(top_thread_message_id); return dialog_info->topic_infos_.get_pointer(top_thread_message_id);
} }
td_api::object_ptr<td_api::updateForumTopicInfo> ForumTopicManager::get_update_forum_topic_info(
DialogId dialog_id, const ForumTopicInfo *topic_info) const {
return td_api::make_object<td_api::updateForumTopicInfo>(dialog_id.get(),
topic_info->get_forum_topic_info_object(td_));
}
void ForumTopicManager::send_update_forum_topic_info(DialogId dialog_id, const ForumTopicInfo *topic_info) const {
send_closure(G()->td(), &Td::send_update, get_update_forum_topic_info(dialog_id, topic_info));
}
} // namespace td } // namespace td

View File

@ -63,6 +63,11 @@ class ForumTopicManager final : public Actor {
const ForumTopicInfo *get_topic_info(DialogId dialog_id, MessageId top_thread_message_id) const; const ForumTopicInfo *get_topic_info(DialogId dialog_id, MessageId top_thread_message_id) const;
td_api::object_ptr<td_api::updateForumTopicInfo> get_update_forum_topic_info(DialogId dialog_id,
const ForumTopicInfo *topic_info) const;
void send_update_forum_topic_info(DialogId dialog_id, const ForumTopicInfo *topic_info) const;
Td *td_; Td *td_;
ActorShared<> parent_; ActorShared<> parent_;