From a7db72d7a7667fc5f06953b37d32d6847e6dfc58 Mon Sep 17 00:00:00 2001
From: "Hector A. Escobedo" <ninjahector.escobedo@gmail.com>
Date: Wed, 22 Feb 2017 18:38:05 -0500
Subject: Add setting to toggle NSFW hiding.

---
 src/components/attachment/attachment.vue | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/components/attachment/attachment.vue')

diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue
index e0eba6a9..577f8444 100644
--- a/src/components/attachment/attachment.vue
+++ b/src/components/attachment/attachment.vue
@@ -1,9 +1,9 @@
 <template>
   <div class="attachment" :class="type">
-    <a class="image-attachment" v-if="hidden" v-on:click.prevent="toggleHidden()">
+    <a class="image-attachment" v-if="hidden && hideNsfwLocal" v-on:click.prevent="toggleHidden()">
       <img :key="nsfwImage" :src="nsfwImage"></img>
     </a>
-    <div class="hider" v-if="nsfw && !hidden">
+    <div class="hider" v-if="nsfw && !hidden && hideNsfwLocal">
       <a href="#" @click.prevent="toggleHidden()">Hide</a>
     </div>
 
-- 
cgit v1.2.3-70-g09d2


From c338940084d7311844d2dd5c11c92f95ab47f486 Mon Sep 17 00:00:00 2001
From: "Hector A. Escobedo" <ninjahector.escobedo@gmail.com>
Date: Wed, 22 Feb 2017 18:59:48 -0500
Subject: Fix syntax errors and hiding logic.

This has been tested.
---
 src/components/attachment/attachment.js  | 14 ++++++++------
 src/components/attachment/attachment.vue |  4 ++--
 src/components/settings/settings.js      |  4 ++--
 src/main.js                              |  6 +++---
 4 files changed, 15 insertions(+), 13 deletions(-)

(limited to 'src/components/attachment/attachment.vue')

diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js
index 8e959903..f4f6aebf 100644
--- a/src/components/attachment/attachment.js
+++ b/src/components/attachment/attachment.js
@@ -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: {
diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue
index 577f8444..45cc1929 100644
--- a/src/components/attachment/attachment.vue
+++ b/src/components/attachment/attachment.vue
@@ -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>
 
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 7d58b64c..c1b88f82 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -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 })
     }
diff --git a/src/main.js b/src/main.js
index e553d9aa..81534cae 100644
--- a/src/main.js
+++ b/src/main.js
@@ -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({
-- 
cgit v1.2.3-70-g09d2

