parent
08992f836a
commit
3e303a444d
|
@ -38,5 +38,12 @@ export function deleteMedia (realm, i) {
|
||||||
store.setComposeData(realm, {
|
store.setComposeData(realm, {
|
||||||
media: composeMedia
|
media: composeMedia
|
||||||
})
|
})
|
||||||
|
if (!composeMedia.length) {
|
||||||
|
const contentWarningShown = store.getComposeData(realm, 'contentWarningShown')
|
||||||
|
const contentWarning = store.getComposeData(realm, 'contentWarning')
|
||||||
|
store.setComposeData(realm, {
|
||||||
|
sensitive: contentWarningShown && contentWarning // reset sensitive if the last media is deleted
|
||||||
|
})
|
||||||
|
}
|
||||||
scheduleIdleTask(() => store.save())
|
scheduleIdleTask(() => store.save())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
composeInput,
|
composeContentWarning,
|
||||||
|
composeInput, composeMediaSensitiveCheckbox, contentWarningButton,
|
||||||
getNthDeleteMediaButton,
|
getNthDeleteMediaButton,
|
||||||
getNthMedia,
|
getNthMedia,
|
||||||
getNthMediaAltInput,
|
getNthMediaAltInput,
|
||||||
|
@ -126,3 +127,32 @@ test('keeps media in local storage', async t => {
|
||||||
.expect(getNthMediaListItem(1).getAttribute('aria-label')).eql('kitten1.jpg')
|
.expect(getNthMediaListItem(1).getAttribute('aria-label')).eql('kitten1.jpg')
|
||||||
.expect(getNthMediaListItem(2).getAttribute('aria-label')).eql('kitten2.jpg')
|
.expect(getNthMediaListItem(2).getAttribute('aria-label')).eql('kitten2.jpg')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('resets sensitive settings when deleting media', async t => {
|
||||||
|
await loginAsFoobar(t)
|
||||||
|
await t
|
||||||
|
.expect(mediaButton.exists).ok()
|
||||||
|
await (uploadKittenImage(1)())
|
||||||
|
await t
|
||||||
|
.click(composeMediaSensitiveCheckbox)
|
||||||
|
.expect(composeMediaSensitiveCheckbox.checked).ok()
|
||||||
|
await (uploadKittenImage(2)())
|
||||||
|
await t
|
||||||
|
.expect(composeMediaSensitiveCheckbox.checked).ok()
|
||||||
|
.click(getNthDeleteMediaButton(2))
|
||||||
|
.expect(getNthMedia(2).exists).notOk()
|
||||||
|
.expect(composeMediaSensitiveCheckbox.checked).ok()
|
||||||
|
.click(getNthDeleteMediaButton(1))
|
||||||
|
.expect(getNthMedia(1).exists).notOk()
|
||||||
|
await (uploadKittenImage(1)())
|
||||||
|
await t
|
||||||
|
.expect(composeMediaSensitiveCheckbox.checked).notOk()
|
||||||
|
.click(contentWarningButton)
|
||||||
|
.typeText(composeContentWarning, 'warn warn warn', { paste: true })
|
||||||
|
.expect(composeMediaSensitiveCheckbox.checked).ok()
|
||||||
|
.click(getNthDeleteMediaButton(1))
|
||||||
|
.expect(getNthMedia(1).exists).notOk()
|
||||||
|
await (uploadKittenImage(1)())
|
||||||
|
await t
|
||||||
|
.expect(composeMediaSensitiveCheckbox.checked).ok()
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue