pinafore/src/routes/_actions/contentWarnings.js

13 wiersze
494 B
JavaScript
Czysty Zwykły widok Historia

import { store } from '../_store/store.js'
2018-03-03 23:44:43 +00:00
export function toggleContentWarningShown (realm) {
2019-08-03 20:49:37 +00:00
const shown = store.getComposeData(realm, 'contentWarningShown')
const contentWarning = store.getComposeData(realm, 'contentWarning')
const newShown = !shown
store.setComposeData(realm, {
contentWarning: newShown ? contentWarning : '',
contentWarningShown: newShown,
sensitive: contentWarning && newShown // toggling content warning automatically toggles sensitive media
})
2018-03-03 23:44:43 +00:00
}