Add option for hiding post statistics (e.g. repeats, favs)

This commit is contained in:
scarlett 2018-09-04 00:41:37 +01:00
parent dcb7e1ecf4
commit bdcbd110e4
9 changed files with 17 additions and 4 deletions

View File

@ -2,6 +2,7 @@ const FavoriteButton = {
props: ['status', 'loggedIn'], props: ['status', 'loggedIn'],
data () { data () {
return { return {
hidePostStatsLocal: this.$store.state.config.hidePostStats,
animated: false animated: false
} }
}, },

View File

@ -1,11 +1,11 @@
<template> <template>
<div v-if="loggedIn"> <div v-if="loggedIn">
<i :class='classes' class='favorite-button fav-active' @click.prevent='favorite()'/> <i :class='classes' class='favorite-button fav-active' @click.prevent='favorite()'/>
<span v-if='status.fave_num > 0'>{{status.fave_num}}</span> <span v-if='!hidePostStatsLocal && status.fave_num > 0'>{{status.fave_num}}</span>
</div> </div>
<div v-else> <div v-else>
<i :class='classes' class='favorite-button'/> <i :class='classes' class='favorite-button'/>
<span v-if='status.fave_num > 0'>{{status.fave_num}}</span> <span v-if='!hidePostStatsLocal && status.fave_num > 0'>{{status.fave_num}}</span>
</div> </div>
</template> </template>

View File

@ -2,6 +2,7 @@ const RetweetButton = {
props: ['status', 'loggedIn', 'visibility'], props: ['status', 'loggedIn', 'visibility'],
data () { data () {
return { return {
hidePostStatsLocal: this.$store.state.config.hidePostStats,
animated: false animated: false
} }
}, },

View File

@ -2,7 +2,7 @@
<div v-if="loggedIn"> <div v-if="loggedIn">
<template v-if="visibility !== 'private' && visibility !== 'direct'"> <template v-if="visibility !== 'private' && visibility !== 'direct'">
<i :class='classes' class='icon-retweet rt-active' v-on:click.prevent='retweet()'></i> <i :class='classes' class='icon-retweet rt-active' v-on:click.prevent='retweet()'></i>
<span v-if='status.repeat_num > 0'>{{status.repeat_num}}</span> <span v-if='!hidePostStatsLocal && status.repeat_num > 0'>{{status.repeat_num}}</span>
</template> </template>
<template v-else> <template v-else>
<i :class='classes' class='icon-lock' :title="$t('timeline.no_retweet_hint')"></i> <i :class='classes' class='icon-lock' :title="$t('timeline.no_retweet_hint')"></i>
@ -10,7 +10,7 @@
</div> </div>
<div v-else-if="!loggedIn"> <div v-else-if="!loggedIn">
<i :class='classes' class='icon-retweet'></i> <i :class='classes' class='icon-retweet'></i>
<span v-if='status.repeat_num > 0'>{{status.repeat_num}}</span> <span v-if='!hidePostStatsLocal && status.repeat_num > 0'>{{status.repeat_num}}</span>
</div> </div>
</template> </template>

View File

@ -10,6 +10,7 @@ const settings = {
hideAttachmentsLocal: this.$store.state.config.hideAttachments, hideAttachmentsLocal: this.$store.state.config.hideAttachments,
hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv, hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv,
hideNsfwLocal: this.$store.state.config.hideNsfw, hideNsfwLocal: this.$store.state.config.hideNsfw,
hidePostStatsLocal: this.$store.state.config.hidePostStats,
hideUserStatsLocal: this.$store.state.config.hideUserStats, hideUserStatsLocal: this.$store.state.config.hideUserStats,
notificationVisibilityLocal: this.$store.state.config.notificationVisibility, notificationVisibilityLocal: this.$store.state.config.notificationVisibility,
replyVisibilityLocal: this.$store.state.config.replyVisibility, replyVisibilityLocal: this.$store.state.config.replyVisibility,
@ -48,6 +49,9 @@ const settings = {
hideAttachmentsInConvLocal (value) { hideAttachmentsInConvLocal (value) {
this.$store.dispatch('setOption', { name: 'hideAttachmentsInConv', value }) this.$store.dispatch('setOption', { name: 'hideAttachmentsInConv', value })
}, },
hidePostStatsLocal (value) {
this.$store.dispatch('setOption', { name: 'hidePostStats', value })
},
hideUserStatsLocal (value) { hideUserStatsLocal (value) {
this.$store.dispatch('setOption', { name: 'hideUserStats', value }) this.$store.dispatch('setOption', { name: 'hideUserStats', value })
}, },

View File

@ -122,6 +122,10 @@
<i class="icon-down-open"/> <i class="icon-down-open"/>
</label> </label>
</div> </div>
<div>
<input type="checkbox" id="hidePostStats" v-model="hidePostStatsLocal">
<label for="hidePostStats">{{$t('settings.hide_post_stats')}}</label>
</div>
<div> <div>
<input type="checkbox" id="hideUserStats" v-model="hideUserStatsLocal"> <input type="checkbox" id="hideUserStats" v-model="hideUserStatsLocal">
<label for="hideUserStats">{{$t('settings.hide_user_stats')}}</label> <label for="hideUserStats">{{$t('settings.hide_user_stats')}}</label>

View File

@ -328,6 +328,7 @@ const en = {
loop_video_silent_only: 'Loop only videos without sound (i.e. Mastodon\'s "gifs")', loop_video_silent_only: 'Loop only videos without sound (i.e. Mastodon\'s "gifs")',
reply_link_preview: 'Enable reply-link preview on mouse hover', reply_link_preview: 'Enable reply-link preview on mouse hover',
replies_in_timeline: 'Replies in timeline', replies_in_timeline: 'Replies in timeline',
hide_post_stats: 'Hide post statistics (e.g. repeat and favorite counts)',
hide_user_stats: 'Hide user statistics (e.g. status and follower counts)', hide_user_stats: 'Hide user statistics (e.g. status and follower counts)',
reply_visibility_all: 'Show all replies', reply_visibility_all: 'Show all replies',
reply_visibility_following: 'Only show replies directed at me or users I\'m following', reply_visibility_following: 'Only show replies directed at me or users I\'m following',

View File

@ -48,6 +48,7 @@ const persistedStateOptions = {
'config.collapseMessageWithSubject', 'config.collapseMessageWithSubject',
'config.hideAttachments', 'config.hideAttachments',
'config.hideAttachmentsInConv', 'config.hideAttachmentsInConv',
'config.hidePostStats',
'config.hideUserStats', 'config.hideUserStats',
'config.hideNsfw', 'config.hideNsfw',
'config.replyVisibility', 'config.replyVisibility',

View File

@ -9,6 +9,7 @@ const defaultState = {
collapseMessageWithSubject: false, collapseMessageWithSubject: false,
hideAttachments: false, hideAttachments: false,
hideAttachmentsInConv: false, hideAttachmentsInConv: false,
hidePostStats: false,
hideUserStats: false, hideUserStats: false,
hideNsfw: true, hideNsfw: true,
loopVideo: true, loopVideo: true,