Do not add file source from self-destructing messages.

GitOrigin-RevId: 5ac703d188ec532a52efa8549ee8c7e63a78a78b
This commit is contained in:
levlam 2020-04-09 18:43:27 +03:00
parent 5c0be2f24f
commit 00a70b466d
2 changed files with 9 additions and 1 deletions

View File

@ -16653,6 +16653,10 @@ FileSourceId MessagesManager::get_message_file_source_id(FullMessageId full_mess
}
void MessagesManager::add_message_file_sources(DialogId dialog_id, const Message *m) {
if (dialog_id.get_type() != DialogType::SecretChat && m->is_content_secret) {
return;
}
auto file_ids = get_message_content_file_ids(m->content.get(), td_);
if (file_ids.empty()) {
return;
@ -16683,6 +16687,10 @@ void MessagesManager::remove_message_file_sources(DialogId dialog_id, const Mess
}
void MessagesManager::change_message_files(DialogId dialog_id, const Message *m, const vector<FileId> &old_file_ids) {
if (dialog_id.get_type() != DialogType::SecretChat && m->is_content_secret) {
return;
}
auto new_file_ids = get_message_content_file_ids(m->content.get(), td_);
if (new_file_ids == old_file_ids) {
return;

View File

@ -4,6 +4,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/files/FileManager.h"
#include "td/telegram/telegram_api.h"
@ -2620,7 +2621,6 @@ void FileManager::run_upload(FileNodePtr node, std::vector<int> bad_parts) {
return;
}
FileView file_view(node);
if (!file_view.has_local_location() && !file_view.has_remote_location()) {
if (node->get_by_hash_ || node->generate_id_ == 0 || !node->generate_was_update_) {