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
fix-streaming-gap-squashed
Louise de Beaufort 2019-07-19 17:09:52 +02:00 zatwierdzone przez Nolan Lawson
rodzic a6235ded8c
commit e5df77b2a8
2 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -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
}
}

Wyświetl plik

@ -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,