logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: ffc23dc68649c19dfac34ff4c0b4211fc72e8523
parent: b939f70d17697eaa5721ac86bcfcd2fc55871df9
Author: Roger Braun <roger@rogerbraun.net>
Date:   Thu, 23 Feb 2017 01:53:52 +0100

Merge branch 'hae/pleroma-fe-develop' into develop

Diffstat:

Msrc/components/attachment/attachment.js13++++++++-----
Msrc/components/attachment/attachment.vue2+-
Msrc/components/settings/settings.js6+++++-
Msrc/components/settings/settings.vue2++
Msrc/main.js5++++-
Msrc/modules/config.js3++-
6 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js @@ -7,16 +7,19 @@ const Attachment = { 'nsfw', 'statusId' ], - data: () => ({ - nsfwImage, - showHidden: false - }), + 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 @@ -3,7 +3,7 @@ <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"> + <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 @@ -3,7 +3,8 @@ 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 } }, components: { @@ -12,6 +13,9 @@ 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/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 @@ -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 @@ -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 = {