2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Refactored code.

- Refactored passing message id to edit media.
 - Removed get/setEditMedia from mainwidget.
 - Combined onEditMedia and onSendFileConfirm in single method.
 - Added argument in FileLoadTask to pass message id to edit media.
 - Renamed flags in apiwrap.
 - Added check for allowing edit media when use clipboard.
 - Removed unused fileIsValidForAlbum.
 - Removed LOGs.
 - Replaced _isNotAlbum with _isAlbum.
 - Removed _viaRemoteContent.
 - Removed _newMediaPath.
 - Added empty() to MessageGroupId.
This commit is contained in:
23rd
2019-04-02 13:38:53 +03:00
committed by John Preston
parent 4988d21819
commit 5d8888bb8b
14 changed files with 94 additions and 118 deletions

View File

@@ -4471,7 +4471,8 @@ void ApiWrap::editMedia(
Storage::PreparedList &&list,
SendMediaType type,
TextWithTags &&caption,
const SendOptions &options) {
const SendOptions &options,
MsgId msgIdToEdit) {
if (list.files.empty()) return;
auto &file = list.files.front();
@@ -4484,7 +4485,7 @@ void ApiWrap::editMedia(
to,
caption,
nullptr,
true));
msgIdToEdit));
}
void ApiWrap::sendFiles(
@@ -4620,17 +4621,17 @@ void ApiWrap::editUploadedPhoto(
MTPVector<MTPInputDocument>(),
MTP_int(0));
auto flags2 = MTPmessages_EditMessage::Flag::f_message | 0;
flags2 |= MTPmessages_EditMessage::Flag::f_no_webpage;
flags2 |= MTPmessages_EditMessage::Flag::f_entities;
flags2 |= MTPmessages_EditMessage::Flag::f_media;
auto flagsEditMsg = MTPmessages_EditMessage::Flag::f_message | 0;
flagsEditMsg |= MTPmessages_EditMessage::Flag::f_no_webpage;
flagsEditMsg |= MTPmessages_EditMessage::Flag::f_entities;
flagsEditMsg |= MTPmessages_EditMessage::Flag::f_media;
auto sentEntities = TextUtilities::EntitiesToMTP(
item->originalText().entities,
TextUtilities::ConvertOption::SkipLocal);
request(MTPmessages_EditMessage(
MTP_flags(flags2),
MTP_flags(flagsEditMsg),
item->history()->peer->input,
MTP_int(item->id),
MTP_string(item->originalText().text),
@@ -4683,18 +4684,17 @@ void ApiWrap::editUploadedDocument(
MTPVector<MTPInputDocument>(),
MTP_int(0));
auto flags2 = MTPmessages_EditMessage::Flag::f_message | 0;
flags2 |= MTPmessages_EditMessage::Flag::f_no_webpage;
flags2 |= MTPmessages_EditMessage::Flag::f_entities;
flags2 |= MTPmessages_EditMessage::Flag::f_media;
auto flagsEditMsg = MTPmessages_EditMessage::Flag::f_message | 0;
flagsEditMsg |= MTPmessages_EditMessage::Flag::f_no_webpage;
flagsEditMsg |= MTPmessages_EditMessage::Flag::f_entities;
flagsEditMsg |= MTPmessages_EditMessage::Flag::f_media;
auto sentEntities = TextUtilities::EntitiesToMTP(
item->originalText().entities,
TextUtilities::ConvertOption::SkipLocal);
request(MTPmessages_EditMessage(
MTP_flags(flags2),
MTP_flags(flagsEditMsg),
item->history()->peer->input,
MTP_int(item->id),
MTP_string(item->originalText().text),