2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +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

@@ -344,13 +344,15 @@ void FillMessagePostFlags(
void SendConfirmedFile(
not_null<Main::Session*> session,
const std::shared_ptr<FileLoadResult> &file,
const std::optional<FullMsgId> &oldId) {
const auto isEditing = oldId.has_value();
const std::shared_ptr<FileLoadResult> &file) {
const auto isEditing = file->to.replaceMediaOf != 0;
const auto channelId = peerToChannel(file->to.peer);
const auto newId = oldId.value_or(
FullMsgId(channelId, session->data().nextLocalMessageId()));
const auto newId = FullMsgId(
channelId,
isEditing
? file->to.replaceMediaOf
: session->data().nextLocalMessageId());
auto groupId = file->album ? file->album->groupId : uint64(0);
if (file->album) {
const auto proj = [](const SendingAlbum::Item &item) {
@@ -361,7 +363,6 @@ void SendConfirmedFile(
it->msgId = newId;
}
file->edit = isEditing;
session->uploader().upload(newId, file);
const auto itemToEdit = isEditing