fix: deleted image wrongfully caching
This commit is contained in:
1 parent
b3793d5dbb
commit
ff0854f331
19 files changed
+201
-87
No files matched your search
@@ -242,8 +242,8 @@ async function handleCopyUrl(id: number) {
|
||||
function deleteDescription(article: Article) {
|
||||
const count = bodyImageCount(article.body)
|
||||
const imagesPhrase =
|
||||
count === 0 ? '' : count === 1 ? ' and its image' : ` and its ${count} images`
|
||||
return `"${article.title}"${imagesPhrase} will be deleted. This can't be undone.`
|
||||
count === 0 ? '' : ' Its images stay in your library.'
|
||||
return `"${article.title}" will be deleted.${imagesPhrase} This can't be undone.`
|
||||
}
|
||||
|
||||
async function performDelete(article: Article) {
|
||||
@@ -255,7 +255,7 @@ async function performDelete(article: Article) {
|
||||
color: 'success',
|
||||
icon: 'i-lucide-circle-check',
|
||||
title: 'Article deleted',
|
||||
description: `"${article.title}" and its images are gone.`,
|
||||
description: `"${article.title}" is gone.`,
|
||||
})
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && err.status === 404) {
|
||||
|
||||
@@ -167,8 +167,8 @@ function handleUnpublish() {
|
||||
function deleteDescription() {
|
||||
const count = bodyImageCount(article.value?.body ?? '')
|
||||
const imagesPhrase =
|
||||
count === 0 ? '' : count === 1 ? ' and its image' : ` and its ${count} images`
|
||||
return `"${article.value?.title ?? ''}"${imagesPhrase} will be deleted. This can't be undone.`
|
||||
count === 0 ? '' : ' Its images stay in your library.'
|
||||
return `"${article.value?.title ?? ''}" will be deleted.${imagesPhrase} This can't be undone.`
|
||||
}
|
||||
|
||||
async function performDelete() {
|
||||
@@ -179,7 +179,7 @@ async function performDelete() {
|
||||
color: 'success',
|
||||
icon: 'i-lucide-circle-check',
|
||||
title: 'Article deleted',
|
||||
description: `"${article.value?.title ?? ''}" and its images are gone.`,
|
||||
description: `"${article.value?.title ?? ''}" is gone.`,
|
||||
})
|
||||
router.push('/article')
|
||||
} catch (err) {
|
||||
|
||||
@@ -599,7 +599,7 @@ describe('Delete confirm — opens the dialog with the row title and image count
|
||||
const props = overlayMock.getProps() as Record<string, unknown>
|
||||
expect(props.title).toBe('Delete this article?')
|
||||
expect(props.description).toBe(
|
||||
'"Winter checklist for timber windows" and its 3 images will be deleted. This can\'t be undone.',
|
||||
'"Winter checklist for timber windows" will be deleted. Its images stay in your library. This can\'t be undone.',
|
||||
)
|
||||
expect(props.confirmLabel).toBe('Delete article')
|
||||
expect(props.cancelLabel).toBe('Cancel')
|
||||
@@ -632,7 +632,7 @@ describe('Deleted — a 204 closes the dialog, removes the row, and moves focus
|
||||
color: 'success',
|
||||
icon: 'i-lucide-circle-check',
|
||||
title: 'Article deleted',
|
||||
description: '"Winter checklist for timber windows" and its images are gone.',
|
||||
description: '"Winter checklist for timber windows" is gone.',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user