Fix merge_choose_generate_location.

GitOrigin-RevId: 811ba253ffab93da2894d8792186b077e8ab3156
This commit is contained in:
levlam 2019-01-19 22:35:28 +03:00
parent 0fc836ce8f
commit c47b737ef7
3 changed files with 11 additions and 4 deletions

View File

@ -2861,12 +2861,16 @@ class CliClient final : public Actor {
send_message(chat_id, make_tl_object<td_api::inputMessageDocument>(
as_local_file(document_path), as_input_thumbnail(as_local_file(thumbnail_path)),
as_caption("test caption")));
} else if (op == "sdg") {
} else if (op == "sdg" || op == "sdgu") {
string chat_id;
string document_path;
string document_conversion;
std::tie(chat_id, args) = split(args);
std::tie(document_path, document_conversion) = split(args);
if (op == "sdgu") {
send_request(
make_tl_object<td_api::uploadFile>(as_generated_file(document_path, document_conversion), nullptr, 1));
}
send_message(chat_id,
make_tl_object<td_api::inputMessageDocument>(as_generated_file(document_path, document_conversion),
nullptr, as_caption("test caption")));

View File

@ -16,6 +16,7 @@
#include <map>
namespace td {
class FileGenerateActor;
class FileGenerateCallback {

View File

@ -972,10 +972,12 @@ static int merge_choose_generate_location(const unique_ptr<FullGenerateFileLocat
if (x_has_mtime != y_has_mtime) {
return x_has_mtime ? 0 : 1;
}
if (x->conversion_ != y->conversion) {
return x->conversion_ >= y->conversion_
? 0
: 1; // the bigger conversion, the bigger mtime or at least more stable choise
}
}
return 2;
}