From 55d33a86650f09088fd2c5feb94f5cfa89f95873 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 13 Jun 2023 12:46:31 +0300 Subject: [PATCH] Never merge story content files. --- td/telegram/StoryContent.cpp | 12 +++--------- td/telegram/StoryContent.h | 2 +- td/telegram/StoryManager.cpp | 4 +--- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/td/telegram/StoryContent.cpp b/td/telegram/StoryContent.cpp index 4f7b63740..aaff428b2 100644 --- a/td/telegram/StoryContent.cpp +++ b/td/telegram/StoryContent.cpp @@ -238,7 +238,7 @@ void compare_story_contents(const StoryContent *old_content, const StoryContent } void merge_story_contents(Td *td, const StoryContent *old_content, StoryContent *new_content, DialogId dialog_id, - bool need_merge_files, bool &is_content_changed, bool &need_update) { + bool &is_content_changed, bool &need_update) { StoryContentType content_type = new_content->get_type(); CHECK(old_content->get_type() == content_type); @@ -246,19 +246,13 @@ void merge_story_contents(Td *td, const StoryContent *old_content, StoryContent case StoryContentType::Photo: { const auto *old_ = static_cast(old_content); auto *new_ = static_cast(new_content); - merge_photos(td, &old_->photo_, &new_->photo_, dialog_id, need_merge_files, is_content_changed, need_update); + merge_photos(td, &old_->photo_, &new_->photo_, dialog_id, false, is_content_changed, need_update); break; } case StoryContentType::Video: { const auto *old_ = static_cast(old_content); const auto *new_ = static_cast(new_content); - if (old_->file_id_ != new_->file_id_) { - if (need_merge_files) { - td->videos_manager_->merge_videos(new_->file_id_, old_->file_id_); - } - need_update = true; - } - if (old_->alt_file_id_ != new_->alt_file_id_) { + if (old_->file_id_ != new_->file_id_ || old_->alt_file_id_ != new_->alt_file_id_) { need_update = true; } break; diff --git a/td/telegram/StoryContent.h b/td/telegram/StoryContent.h index 9b0d6dbca..1f982dcc4 100644 --- a/td/telegram/StoryContent.h +++ b/td/telegram/StoryContent.h @@ -44,7 +44,7 @@ void compare_story_contents(Td *td, const StoryContent *old_content, const Story bool &is_content_changed, bool &need_update); void merge_story_contents(Td *td, const StoryContent *old_content, StoryContent *new_content, DialogId dialog_id, - bool need_merge_files, bool &is_content_changed, bool &need_update); + bool &is_content_changed, bool &need_update); unique_ptr copy_story_content(const StoryContent *content); diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index 519c82e88..93bac92ef 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -793,10 +793,8 @@ StoryId StoryManager::on_get_story(DialogId owner_dialog_id, story->content_ = std::move(content); is_changed = true; } else { - merge_story_contents(td_, story->content_.get(), content.get(), owner_dialog_id, false, need_save_to_database, - is_changed); + merge_story_contents(td_, story->content_.get(), content.get(), owner_dialog_id, need_save_to_database, is_changed); story->content_ = std::move(content); - // story->last_edit_pts_ = 0; } if (is_changed || need_save_to_database) {