Send updateSavedMessagesTopic when last topic message changes.

This commit is contained in:
levlam 2024-02-06 16:08:41 +03:00
parent 7f0f3e9ff0
commit 73f3696eda
3 changed files with 15 additions and 0 deletions

View File

@ -28489,6 +28489,9 @@ void MessagesManager::send_update_last_message_if_needed(const Dialog *d, const
if (m->message_id == d->last_message_id) { if (m->message_id == d->last_message_id) {
send_update_chat_last_message_impl(d, source); send_update_chat_last_message_impl(d, source);
} }
if (d->dialog_id == td_->dialog_manager_->get_my_dialog_id() && m->saved_messages_topic_id.is_valid()) {
td_->saved_messages_manager_->on_topic_message_updated(m->saved_messages_topic_id, m->message_id);
}
} }
void MessagesManager::send_update_chat_last_message(Dialog *d, const char *source) { void MessagesManager::send_update_chat_last_message(Dialog *d, const char *source) {

View File

@ -353,6 +353,16 @@ void SavedMessagesManager::do_set_topic_last_message_id(SavedMessagesTopic *topi
topic->is_changed_ = true; topic->is_changed_ = true;
} }
void SavedMessagesManager::on_topic_message_updated(SavedMessagesTopicId saved_messages_topic_id,
MessageId message_id) {
auto *topic = get_topic(saved_messages_topic_id);
if (topic == nullptr || topic->last_message_id_ != message_id) {
return;
}
send_update_saved_messages_topic(topic);
}
void SavedMessagesManager::on_topic_message_deleted(SavedMessagesTopicId saved_messages_topic_id, void SavedMessagesManager::on_topic_message_deleted(SavedMessagesTopicId saved_messages_topic_id,
MessageId message_id) { MessageId message_id) {
auto *topic = get_topic(saved_messages_topic_id); auto *topic = get_topic(saved_messages_topic_id);

View File

@ -29,6 +29,8 @@ class SavedMessagesManager final : public Actor {
void set_topic_last_message_id(SavedMessagesTopicId saved_messages_topic_id, MessageId last_message_id, void set_topic_last_message_id(SavedMessagesTopicId saved_messages_topic_id, MessageId last_message_id,
int32 last_message_date); int32 last_message_date);
void on_topic_message_updated(SavedMessagesTopicId saved_messages_topic_id, MessageId message_id);
void on_topic_message_deleted(SavedMessagesTopicId saved_messages_topic_id, MessageId message_id); void on_topic_message_deleted(SavedMessagesTopicId saved_messages_topic_id, MessageId message_id);
void get_pinned_saved_messages_topics(Promise<td_api::object_ptr<td_api::foundSavedMessagesTopics>> &&promise); void get_pinned_saved_messages_topics(Promise<td_api::object_ptr<td_api::foundSavedMessagesTopics>> &&promise);