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

This commit is contained in:
Roger Braun 2017-02-23 01:53:52 +01:00
commit ffc23dc686
6 changed files with 22 additions and 9 deletions

View file

@ -7,16 +7,19 @@ const Attachment = {
'nsfw', 'nsfw',
'statusId' 'statusId'
], ],
data: () => ({ data () {
nsfwImage, return {
showHidden: false nsfwImage,
}), hideNsfwLocal: this.$store.state.config.hideNsfw,
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: {

View file

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

View file

@ -3,7 +3,8 @@ 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
} }
}, },
components: { components: {
@ -12,6 +13,9 @@ const settings = {
watch: { watch: {
hideAttachmentsLocal (value) { hideAttachmentsLocal (value) {
this.$store.dispatch('setOption', { name: 'hideAttachments', value }) this.$store.dispatch('setOption', { name: 'hideAttachments', value })
},
hideNsfwLocal (value) {
this.$store.dispatch('setOption', { name: 'hideNsfw', value })
} }
} }
} }

View file

@ -12,6 +12,8 @@
<h2>Attachments</h2> <h2>Attachments</h2>
<input type="checkbox" id="hideAttachments" v-model="hideAttachmentsLocal"> <input type="checkbox" id="hideAttachments" v-model="hideAttachmentsLocal">
<label for="hideAttachments">Hide Attachments</label> <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> </div>
</div> </div>

View file

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

View file

@ -4,7 +4,8 @@ import StyleSetter from '../services/style_setter/style_setter.js'
const defaultState = { const defaultState = {
name: 'Pleroma FE', name: 'Pleroma FE',
colors: {}, colors: {},
hideAttachments: false hideAttachments: false,
hideNsfw: true
} }
const config = { const config = {