Update media if caption was changed (#1138)
Doesn't work yet as the `/api/v1/media/:id` returns 404?! wtf?!
This commit is contained in:
parent
89b7df25ea
commit
80cd22a356
|
@ -115,8 +115,22 @@ extension MastodonEditStatusPublisher: StatusPublisher {
|
||||||
guard case let AttachmentViewModel.Input.mastodonAssetUrl(_, attachmentId) = attachmentViewModel.input else {
|
guard case let AttachmentViewModel.Input.mastodonAssetUrl(_, attachmentId) = attachmentViewModel.input else {
|
||||||
throw AppError.badRequest
|
throw AppError.badRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
attachmentIDs.append(attachmentId)
|
attachmentIDs.append(attachmentId)
|
||||||
break
|
let needsUpdate = (attachmentViewModel.caption != attachmentViewModel.originalCaption)
|
||||||
|
if needsUpdate {
|
||||||
|
_ = try await api.updateMedia(
|
||||||
|
domain: authContext.mastodonAuthenticationBox.domain,
|
||||||
|
attachmentID: attachmentId,
|
||||||
|
query: Mastodon.API.Media.UpdateMediaQuery(
|
||||||
|
file: nil,
|
||||||
|
thumbnail: nil,
|
||||||
|
description: attachmentViewModel.caption,
|
||||||
|
focus: nil
|
||||||
|
),
|
||||||
|
mastodonAuthenticationBox: authContext.mastodonAuthenticationBox
|
||||||
|
).singleOutput()
|
||||||
|
}
|
||||||
case let .uploadedMastodonAttachment(attachment):
|
case let .uploadedMastodonAttachment(attachment):
|
||||||
attachmentIDs.append(attachment.id)
|
attachmentIDs.append(attachment.id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue