fix: add attributes before status update (#2293)
parent
67d5d5c00a
commit
d975c6fc2c
|
@ -111,11 +111,20 @@ export function usePublish(options: {
|
||||||
isSending = true
|
isSending = true
|
||||||
|
|
||||||
let status: mastodon.v1.Status
|
let status: mastodon.v1.Status
|
||||||
if (!draft.editingStatus)
|
if (!draft.editingStatus) {
|
||||||
status = await client.v1.statuses.create(payload)
|
status = await client.v1.statuses.create(payload)
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else {
|
||||||
status = await client.v1.statuses.update(draft.editingStatus.id, payload)
|
const updatePayload = {
|
||||||
|
...payload,
|
||||||
|
mediaAttributes: draft.attachments.map(media => ({
|
||||||
|
id: media.id,
|
||||||
|
description: media.description,
|
||||||
|
})),
|
||||||
|
} as mastodon.v1.UpdateStatusParams
|
||||||
|
status = await client.v1.statuses.update(draft.editingStatus.id, updatePayload)
|
||||||
|
}
|
||||||
if (draft.params.inReplyToId)
|
if (draft.params.inReplyToId)
|
||||||
navigateToStatus({ status })
|
navigateToStatus({ status })
|
||||||
|
|
||||||
|
@ -256,6 +265,7 @@ export function useUploadMediaAttachment(draftRef: Ref<Draft>) {
|
||||||
|
|
||||||
async function setDescription(att: mastodon.v1.MediaAttachment, description: string) {
|
async function setDescription(att: mastodon.v1.MediaAttachment, description: string) {
|
||||||
att.description = description
|
att.description = description
|
||||||
|
if (!draft.editingStatus)
|
||||||
await client.v1.mediaAttachments.update(att.id, { description: att.description })
|
await client.v1.mediaAttachments.update(att.id, { description: att.description })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue