Add setting to hide all attachments.

This commit is contained in:
Roger Braun 2017-02-23 00:04:47 +01:00
parent 0e1ab69c33
commit 7c0f3ea666
6 changed files with 20 additions and 3 deletions

View File

@ -1,8 +1,18 @@
import StyleSwitcher from '../style_switcher/style_switcher.vue' import StyleSwitcher from '../style_switcher/style_switcher.vue'
const settings = { const settings = {
data () {
return {
hideAttachmentsLocal: this.$store.state.config.hideAttachments
}
},
components: { components: {
StyleSwitcher StyleSwitcher
},
watch: {
hideAttachmentsLocal (value) {
this.$store.dispatch('setOption', { name: 'hideAttachments', value })
}
} }
} }

View File

@ -8,6 +8,11 @@
<h2>Theme</h2> <h2>Theme</h2>
<style-switcher></style-switcher> <style-switcher></style-switcher>
</div> </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>
</div> </div>
</template> </template>

View File

@ -17,6 +17,7 @@ const Status = {
userExpanded: false userExpanded: false
}), }),
computed: { computed: {
hideAttachments () { return this.$store.state.config.hideAttachments },
retweet () { return !!this.statusoid.retweeted_status }, retweet () { return !!this.statusoid.retweeted_status },
retweeter () { return this.statusoid.user.name }, retweeter () { return this.statusoid.user.name },
status () { status () {

View File

@ -57,7 +57,7 @@
<div @click.prevent="linkClicked" class="status-content" v-html="status.statusnet_html"></div> <div @click.prevent="linkClicked" class="status-content" v-html="status.statusnet_html"></div>
<div v-if='status.attachments' class='attachments'> <div v-if='status.attachments' class='attachments'>
<attachment :status-id="status.id" :nsfw="status.nsfw" :attachment="attachment" v-for="attachment in status.attachments"> <attachment v-if="!hideAttachments" :status-id="status.id" :nsfw="status.nsfw" :attachment="attachment" v-for="attachment in status.attachments">
</attachment> </attachment>
</div> </div>
</div> </div>

View File

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

View File

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