Fix syntax errors and hiding logic.
This has been tested.
This commit is contained in:
parent
a7db72d7a7
commit
c338940084
4 changed files with 15 additions and 13 deletions
|
@ -7,17 +7,19 @@ const Attachment = {
|
||||||
'nsfw',
|
'nsfw',
|
||||||
'statusId'
|
'statusId'
|
||||||
],
|
],
|
||||||
data: () => ({
|
data () {
|
||||||
|
return {
|
||||||
nsfwImage,
|
nsfwImage,
|
||||||
hideNsfwLocal: this.$store.state.config.hideNsfw,
|
hideNsfwLocal: this.$store.state.config.hideNsfw,
|
||||||
showHidden: !this.hideNsfwLocal
|
showHidden: false
|
||||||
}),
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
type () {
|
type () {
|
||||||
return fileTypeService.fileType(this.attachment.mimetype)
|
return fileTypeService.fileType(this.attachment.mimetype)
|
||||||
},
|
},
|
||||||
hidden () {
|
hidden () {
|
||||||
return this.nsfw && !this.showHidden
|
return this.nsfw && this.hideNsfwLocal && !this.showHidden
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="attachment" :class="type">
|
<div class="attachment" :class="type">
|
||||||
<a class="image-attachment" v-if="hidden && hideNsfwLocal" v-on:click.prevent="toggleHidden()">
|
<a class="image-attachment" v-if="hidden" v-on:click.prevent="toggleHidden()">
|
||||||
<img :key="nsfwImage" :src="nsfwImage"></img>
|
<img :key="nsfwImage" :src="nsfwImage"></img>
|
||||||
</a>
|
</a>
|
||||||
<div class="hider" v-if="nsfw && !hidden && hideNsfwLocal">
|
<div class="hider" v-if="nsfw && hideNsfwLocal && !hidden">
|
||||||
<a href="#" @click.prevent="toggleHidden()">Hide</a>
|
<a href="#" @click.prevent="toggleHidden()">Hide</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import StyleSwitcher from '../style_switcher/style_switcher.vue'
|
||||||
const settings = {
|
const settings = {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
hideAttachmentsLocal: this.$store.state.config.hideAttachments
|
hideAttachmentsLocal: this.$store.state.config.hideAttachments,
|
||||||
hideNsfwLocal: this.$store.state.config.hideNsfw
|
hideNsfwLocal: this.$store.state.config.hideNsfw
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -13,7 +13,7 @@ const settings = {
|
||||||
watch: {
|
watch: {
|
||||||
hideAttachmentsLocal (value) {
|
hideAttachmentsLocal (value) {
|
||||||
this.$store.dispatch('setOption', { name: 'hideAttachments', value })
|
this.$store.dispatch('setOption', { name: 'hideAttachments', value })
|
||||||
}
|
},
|
||||||
hideNsfwLocal (value) {
|
hideNsfwLocal (value) {
|
||||||
this.$store.dispatch('setOption', { name: 'hideNsfw', value })
|
this.$store.dispatch('setOption', { name: 'hideNsfw', value })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue