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

View file

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

View file

@ -17,7 +17,10 @@ const Status = {
userExpanded: false userExpanded: false
}), }),
computed: { 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 }, retweet () { return !!this.statusoid.retweeted_status },
retweeter () { return this.statusoid.user.name }, retweeter () { return this.statusoid.user.name },
status () { status () {

View file

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

View file

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