Fix syntax errors and hiding logic.

This has been tested.
This commit is contained in:
Hector A. Escobedo 2017-02-22 18:59:48 -05:00
parent a7db72d7a7
commit c338940084
4 changed files with 15 additions and 13 deletions

View File

@ -7,17 +7,19 @@ const Attachment = {
'nsfw',
'statusId'
],
data: () => ({
nsfwImage,
hideNsfwLocal: this.$store.state.config.hideNsfw,
showHidden: !this.hideNsfwLocal
}),
data () {
return {
nsfwImage,
hideNsfwLocal: this.$store.state.config.hideNsfw,
showHidden: false
}
},
computed: {
type () {
return fileTypeService.fileType(this.attachment.mimetype)
},
hidden () {
return this.nsfw && !this.showHidden
return this.nsfw && this.hideNsfwLocal && !this.showHidden
}
},
methods: {

View File

@ -1,9 +1,9 @@
<template>
<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>
</a>
<div class="hider" v-if="nsfw && !hidden && hideNsfwLocal">
<div class="hider" v-if="nsfw && hideNsfwLocal && !hidden">
<a href="#" @click.prevent="toggleHidden()">Hide</a>
</div>

View File

@ -3,7 +3,7 @@ import StyleSwitcher from '../style_switcher/style_switcher.vue'
const settings = {
data () {
return {
hideAttachmentsLocal: this.$store.state.config.hideAttachments
hideAttachmentsLocal: this.$store.state.config.hideAttachments,
hideNsfwLocal: this.$store.state.config.hideNsfw
}
},
@ -13,7 +13,7 @@ const settings = {
watch: {
hideAttachmentsLocal (value) {
this.$store.dispatch('setOption', { name: 'hideAttachments', value })
}
},
hideNsfwLocal (value) {
this.$store.dispatch('setOption', { name: 'hideNsfw', value })
}

View File

@ -30,9 +30,9 @@ Vue.use(VueTimeago, {
const persistedStateOptions = {
paths: ['config.hideAttachments',
'config.hideNsfw',
'statuses.notifications',
'users.users']
'config.hideNsfw',
'statuses.notifications',
'users.users']
}
const store = new Vuex.Store({