Add option to only hide attachments on timeline

This commit is contained in:
wakarimasen 2017-03-04 21:25:59 +01:00
parent 049c74f8e8
commit 6bcbed38d0
5 changed files with 27 additions and 5 deletions

View file

@ -4,6 +4,7 @@ const settings = {
data () {
return {
hideAttachmentsLocal: this.$store.state.config.hideAttachments,
hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv,
hideNsfwLocal: this.$store.state.config.hideNsfw
}
},
@ -14,6 +15,9 @@ const settings = {
hideAttachmentsLocal (value) {
this.$store.dispatch('setOption', { name: 'hideAttachments', value })
},
hideAttachmentsInConvLocal (value) {
this.$store.dispatch('setOption', { name: 'hideAttachmentsInConv', value })
},
hideNsfwLocal (value) {
this.$store.dispatch('setOption', { name: 'hideNsfw', value })
}

View file

@ -10,10 +10,20 @@
</div>
<div class="setting-item">
<h2>Attachments</h2>
<ul class="setting-list">
<li>
<input type="checkbox" id="hideAttachments" v-model="hideAttachmentsLocal">
<label for="hideAttachments">Hide Attachments</label>
<label for="hideAttachments">Hide attachments on timeline</label>
</li>
<li>
<input type="checkbox" id="hideAttachmentsInConv" v-model="hideAttachmentsInConvLocal">
<label for="hideAttachmentsInConv">Hide attachments in conversations</label>
</li>
<li>
<input type="checkbox" id="hideNsfw" v-model="hideNsfwLocal">
<label for="hideNsfw">Enable clickthrough NSFW attachment hiding</label>
</li>
</ul>
</div>
</div>
</div>
@ -26,4 +36,7 @@
.setting-item {
margin: 1em 1em 1.4em;
}
.setting-list {
list-style-type: none;
}
</style>

View file

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

View file

@ -31,6 +31,7 @@ Vue.use(VueTimeago, {
const persistedStateOptions = {
paths: [
'config.hideAttachments',
'config.hideAttachmentsInConv',
'config.hideNsfw',
'statuses.notifications',
'users.users'

View file

@ -5,6 +5,7 @@ const defaultState = {
name: 'Pleroma FE',
colors: {},
hideAttachments: false,
hideAttachmentsInConv: false,
hideNsfw: true
}