forked from AkkomaGang/akkoma-fe
Add setting to toggle NSFW hiding.
This commit is contained in:
parent
b939f70d17
commit
a7db72d7a7
6 changed files with 16 additions and 5 deletions
|
@ -9,7 +9,8 @@ const Attachment = {
|
||||||
],
|
],
|
||||||
data: () => ({
|
data: () => ({
|
||||||
nsfwImage,
|
nsfwImage,
|
||||||
showHidden: false
|
hideNsfwLocal: this.$store.state.config.hideNsfw,
|
||||||
|
showHidden: !this.hideNsfwLocal
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
type () {
|
type () {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="attachment" :class="type">
|
<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>
|
<img :key="nsfwImage" :src="nsfwImage"></img>
|
||||||
</a>
|
</a>
|
||||||
<div class="hider" v-if="nsfw && !hidden">
|
<div class="hider" v-if="nsfw && !hidden && hideNsfwLocal">
|
||||||
<a href="#" @click.prevent="toggleHidden()">Hide</a>
|
<a href="#" @click.prevent="toggleHidden()">Hide</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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: {
|
||||||
|
@ -13,6 +14,9 @@ const settings = {
|
||||||
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 })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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({
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
Loading…
Reference in a new issue