mark sensitive/spoiler scoped to instance

This commit is contained in:
Nolan Lawson 2018-01-27 18:06:44 -08:00
parent bda07e3f22
commit 01ea4cbc87

View file

@ -333,22 +333,30 @@
} }
return content return content
}, },
spoilerShown: ($spoilersShown, statusId) => $spoilersShown && $spoilersShown[statusId], spoilerShown: ($spoilersShown, $currentInstance, statusId) => $spoilersShown && $spoilersShown[$currentInstance] && $spoilersShown[$currentInstance][statusId],
sensitiveShown: ($sensitivesShown, statusId) => $sensitivesShown && $sensitivesShown[statusId], sensitiveShown: ($sensitivesShown, $currentInstance, statusId) => $sensitivesShown && $sensitivesShown[$currentInstance] && $sensitivesShown[$currentInstance][statusId],
}, },
methods: { methods: {
onClickSpoilerButton() { onClickSpoilerButton() {
let $spoilersShown = this.store.get('spoilersShown') || {}
let statusId = this.get('statusId') let statusId = this.get('statusId')
$spoilersShown[statusId] = !$spoilersShown[statusId] let instanceName = this.store.get('currentInstance')
let $spoilersShown = this.store.get('spoilersShown') || {}
if (!$spoilersShown[instanceName]) {
$spoilersShown[instanceName] = {}
}
$spoilersShown[instanceName][statusId] = !$spoilersShown[instanceName][statusId]
this.store.set({'spoilersShown': $spoilersShown}) this.store.set({'spoilersShown': $spoilersShown})
this.hydrateContent() this.hydrateContent()
this.fire('recalculateHeight') this.fire('recalculateHeight')
}, },
onClickSensitiveMediaButton() { onClickSensitiveMediaButton() {
let $sensitivesShown = this.store.get('sensitivesShown') || {}
let statusId = this.get('statusId') let statusId = this.get('statusId')
$sensitivesShown[statusId] = !$sensitivesShown[statusId] let instanceName = this.store.get('currentInstance')
let $sensitivesShown = this.store.get('sensitivesShown') || {}
if (!$sensitivesShown[instanceName]) {
$sensitivesShown[instanceName] = {}
}
$sensitivesShown[instanceName][statusId] = !$sensitivesShown[instanceName][statusId]
this.store.set({'sensitivesShown': $sensitivesShown}) this.store.set({'sensitivesShown': $sensitivesShown})
this.fire('recalculateHeight') this.fire('recalculateHeight')
}, },