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

Slightly refactored uploading of edit media.

This commit is contained in:
23rd
2021-03-09 12:11:40 +03:00
parent bbeb9d3950
commit d4bb62d055
11 changed files with 35 additions and 41 deletions

View File

@@ -494,8 +494,7 @@ FileLoadTask::FileLoadTask(
SendMediaType type,
const FileLoadTo &to,
const TextWithTags &caption,
std::shared_ptr<SendingAlbum> album,
MsgId msgIdToEdit)
std::shared_ptr<SendingAlbum> album)
: _id(openssl::RandomValue<uint64>())
, _session(session)
, _dcId(session->mainDcId())
@@ -505,10 +504,9 @@ FileLoadTask::FileLoadTask(
, _content(content)
, _information(std::move(information))
, _type(type)
, _caption(caption)
, _msgIdToEdit(msgIdToEdit) {
, _caption(caption) {
Expects(to.options.scheduled
|| (_msgIdToEdit == 0 || IsServerMsgId(_msgIdToEdit)));
|| (to.replaceMediaOf == 0 || IsServerMsgId(to.replaceMediaOf)));
}
FileLoadTask::FileLoadTask(
@@ -690,8 +688,6 @@ void FileLoadTask::process(Args &&args) {
_caption,
_album);
_result->edit = (_msgIdToEdit > 0);
QString filename, filemime;
qint64 filesize = 0;
QByteArray filedata;
@@ -993,12 +989,7 @@ void FileLoadTask::finish() {
Ui::LayerOption::KeepOther);
removeFromAlbum();
} else if (const auto session = _session.get()) {
const auto fullId = _msgIdToEdit
? std::make_optional(FullMsgId(
peerToChannel(_to.peer),
_msgIdToEdit))
: std::nullopt;
Api::SendConfirmedFile(session, _result, fullId);
Api::SendConfirmedFile(session, _result);
}
}