From 7c0f3ea666a866a3bb1f2e8da161ae69901e519b Mon Sep 17 00:00:00 2001
From: Roger Braun <roger@rogerbraun.net>
Date: Thu, 23 Feb 2017 00:04:47 +0100
Subject: Add setting to hide all attachments.

---
 src/components/settings/settings.vue | 5 +++++
 1 file changed, 5 insertions(+)

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

diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 57aafac8..f2f83953 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -8,6 +8,11 @@
         <h2>Theme</h2>
         <style-switcher></style-switcher>
       </div>
+      <div class="setting-item">
+        <h2>Attachments</h2>
+        <input type="checkbox" id="hideAttachments" v-model="hideAttachmentsLocal">
+        <label for="hideAttachments">Hide Attachments</label>
+      </div>
     </div>
   </div>
 </template>
-- 
cgit v1.2.3-70-g09d2


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.js  | 3 ++-
 src/components/attachment/attachment.vue | 4 ++--
 src/components/settings/settings.js      | 4 ++++
 src/components/settings/settings.vue     | 2 ++
 src/main.js                              | 5 ++++-
 src/modules/config.js                    | 3 ++-
 6 files changed, 16 insertions(+), 5 deletions(-)

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

diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js
index 57d21b28..8e959903 100644
--- a/src/components/attachment/attachment.js
+++ b/src/components/attachment/attachment.js
@@ -9,7 +9,8 @@ const Attachment = {
   ],
   data: () => ({
     nsfwImage,
-    showHidden: false
+    hideNsfwLocal: this.$store.state.config.hideNsfw,
+    showHidden: !this.hideNsfwLocal
   }),
   computed: {
     type () {
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>
 
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 61236af2..7d58b64c 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -4,6 +4,7 @@ const settings = {
   data () {
     return {
       hideAttachmentsLocal: this.$store.state.config.hideAttachments
+      hideNsfwLocal: this.$store.state.config.hideNsfw
     }
   },
   components: {
@@ -13,6 +14,9 @@ const settings = {
     hideAttachmentsLocal (value) {
       this.$store.dispatch('setOption', { name: 'hideAttachments', value })
     }
+    hideNsfwLocal (value) {
+      this.$store.dispatch('setOption', { name: 'hideNsfw', value })
+    }
   }
 }
 
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index f2f83953..89b89a39 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -12,6 +12,8 @@
         <h2>Attachments</h2>
         <input type="checkbox" id="hideAttachments" v-model="hideAttachmentsLocal">
         <label for="hideAttachments">Hide Attachments</label>
+        <input type="checkbox" id="hideNsfw" v-model="hideNsfwLocal">
+        <label for="hideNsfw">Enable clickthrough NSFW attachment hiding</label>
       </div>
     </div>
   </div>
diff --git a/src/main.js b/src/main.js
index 51d281fa..e553d9aa 100644
--- a/src/main.js
+++ b/src/main.js
@@ -29,7 +29,10 @@ Vue.use(VueTimeago, {
 })
 
 const persistedStateOptions = {
-  paths: ['users.users', 'statuses.notifications', 'config.hideAttachments']
+  paths: ['config.hideAttachments',
+          'config.hideNsfw',
+          'statuses.notifications',
+          'users.users']
 }
 
 const store = new Vuex.Store({
diff --git a/src/modules/config.js b/src/modules/config.js
index 25de98ea..896a6978 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -4,7 +4,8 @@ import StyleSetter from '../services/style_setter/style_setter.js'
 const defaultState = {
   name: 'Pleroma FE',
   colors: {},
-  hideAttachments: false
+  hideAttachments: false,
+  hideNsfw: true
 }
 
 const config = {
-- 
cgit v1.2.3-70-g09d2

