fix: Use unformatted status content in deleteAndRedraft (#1340)
* Use unformatted status content in deleteAndRedraft * deleteStatus always returns an object even when the deletion fails * throw error fixes #1340
This commit is contained in:
parent
a6235ded8c
commit
e5df77b2a8
|
@ -6,11 +6,13 @@ import { deleteStatus as deleteStatusLocally } from './deleteStatuses'
|
|||
export async function doDeleteStatus (statusId) {
|
||||
let { currentInstance, accessToken } = store.get()
|
||||
try {
|
||||
await deleteStatus(currentInstance, accessToken, statusId)
|
||||
let deletedStatus = await deleteStatus(currentInstance, accessToken, statusId)
|
||||
deleteStatusLocally(currentInstance, statusId)
|
||||
toast.say('Status deleted.')
|
||||
return deletedStatus
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
toast.say('Unable to delete status: ' + (e.message || ''))
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ import { store } from '../_store/store'
|
|||
export async function deleteAndRedraft (status) {
|
||||
let deleteStatusPromise = doDeleteStatus(status.id)
|
||||
let dialogPromise = importShowComposeDialog()
|
||||
await deleteStatusPromise
|
||||
let deletedStatus = await deleteStatusPromise
|
||||
|
||||
store.setComposeData('dialog', {
|
||||
text: statusHtmlToPlainText(status.content, status.mentions),
|
||||
text: deletedStatus.text || statusHtmlToPlainText(status.content, status.mentions),
|
||||
contentWarningShown: !!status.spoiler_text,
|
||||
contentWarning: status.spoiler_text || '',
|
||||
postPrivacy: status.visibility,
|
||||
|
|
Loading…
Reference in a new issue