diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/favorite_button/favorite_button.js | 3 | ||||
| -rw-r--r-- | src/components/favorite_button/favorite_button.vue | 4 | ||||
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 10 | ||||
| -rw-r--r-- | src/components/retweet_button/retweet_button.js | 3 | ||||
| -rw-r--r-- | src/components/retweet_button/retweet_button.vue | 4 | ||||
| -rw-r--r-- | src/components/settings/settings.js | 14 | ||||
| -rw-r--r-- | src/components/settings/settings.vue | 12 | ||||
| -rw-r--r-- | src/components/status/status.js | 15 | ||||
| -rw-r--r-- | src/components/user_card_content/user_card_content.js | 7 | ||||
| -rw-r--r-- | src/components/user_card_content/user_card_content.vue | 10 |
10 files changed, 66 insertions, 16 deletions
diff --git a/src/components/favorite_button/favorite_button.js b/src/components/favorite_button/favorite_button.js index 1266be90..a2b4cb65 100644 --- a/src/components/favorite_button/favorite_button.js +++ b/src/components/favorite_button/favorite_button.js @@ -2,6 +2,9 @@ const FavoriteButton = { props: ['status', 'loggedIn'], data () { return { + hidePostStatsLocal: typeof this.$store.state.config.hidePostStats === 'undefined' + ? this.$store.state.instance.hidePostStats + : this.$store.state.config.hidePostStats, animated: false } }, diff --git a/src/components/favorite_button/favorite_button.vue b/src/components/favorite_button/favorite_button.vue index 1e1a6970..71cb875e 100644 --- a/src/components/favorite_button/favorite_button.vue +++ b/src/components/favorite_button/favorite_button.vue @@ -1,11 +1,11 @@ <template> <div v-if="loggedIn"> <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 v-else> <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> </template> diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 804c4bc2..e49c3ccc 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -59,7 +59,7 @@ const PostStatusForm = { posting: false, highlighted: 0, newStatus: { - spoilerText: this.subject, + spoilerText: this.subject || '', status: statusText, contentType: 'text/plain', nsfw: false, @@ -134,6 +134,9 @@ const PostStatusForm = { statusLength () { return this.newStatus.status.length }, + spoilerTextLength () { + return this.newStatus.spoilerText.length + }, statusLengthLimit () { return this.$store.state.instance.textlimit }, @@ -141,10 +144,10 @@ const PostStatusForm = { return this.statusLengthLimit > 0 }, charactersLeft () { - return this.statusLengthLimit - this.statusLength + return this.statusLengthLimit - (this.statusLength + this.spoilerTextLength) }, isOverLengthLimit () { - return this.hasStatusLengthLimit && (this.statusLength > this.statusLengthLimit) + return this.hasStatusLengthLimit && (this.charactersLeft < 0) }, scopeOptionsEnabled () { return this.$store.state.instance.scopeOptionsEnabled @@ -229,6 +232,7 @@ const PostStatusForm = { if (!data.error) { this.newStatus = { status: '', + spoilerText: '', files: [], visibility: newStatus.visibility, contentType: newStatus.contentType diff --git a/src/components/retweet_button/retweet_button.js b/src/components/retweet_button/retweet_button.js index cafa9cbc..eb4e4b41 100644 --- a/src/components/retweet_button/retweet_button.js +++ b/src/components/retweet_button/retweet_button.js @@ -2,6 +2,9 @@ const RetweetButton = { props: ['status', 'loggedIn', 'visibility'], data () { return { + hidePostStatsLocal: typeof this.$store.state.config.hidePostStats === 'undefined' + ? this.$store.state.instance.hidePostStats + : this.$store.state.config.hidePostStats, animated: false } }, diff --git a/src/components/retweet_button/retweet_button.vue b/src/components/retweet_button/retweet_button.vue index ee5722bd..5b1e64b8 100644 --- a/src/components/retweet_button/retweet_button.vue +++ b/src/components/retweet_button/retweet_button.vue @@ -2,7 +2,7 @@ <div v-if="loggedIn"> <template v-if="visibility !== 'private' && visibility !== 'direct'"> <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 v-else> <i :class='classes' class='icon-lock' :title="$t('timeline.no_retweet_hint')"></i> @@ -10,7 +10,7 @@ </div> <div v-else-if="!loggedIn"> <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> </template> diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index a7c2c565..910eea63 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -13,6 +13,14 @@ const settings = { hideAttachmentsLocal: user.hideAttachments, hideAttachmentsInConvLocal: user.hideAttachmentsInConv, hideNsfwLocal: user.hideNsfw, + hidePostStatsLocal: typeof user.hidePostStats === 'undefined' + ? instance.hidePostStats + : user.hidePostStats, + hidePostStatsDefault: this.$t('settings.values.' + instance.hidePostStats), + hideUserStatsLocal: typeof user.hideUserStats === 'undefined' + ? instance.hideUserStats + : user.hideUserStats, + hideUserStatsDefault: this.$t('settings.values.' + instance.hideUserStats), notificationVisibilityLocal: user.notificationVisibility, replyVisibilityLocal: user.replyVisibility, loopVideoLocal: user.loopVideo, @@ -62,6 +70,12 @@ const settings = { hideAttachmentsInConvLocal (value) { this.$store.dispatch('setOption', { name: 'hideAttachmentsInConv', value }) }, + hidePostStatsLocal (value) { + this.$store.dispatch('setOption', { name: 'hidePostStats', value }) + }, + hideUserStatsLocal (value) { + this.$store.dispatch('setOption', { name: 'hideUserStats', value }) + }, hideNsfwLocal (value) { this.$store.dispatch('setOption', { name: 'hideNsfw', value }) }, diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index 5a5b2fb4..4a236d23 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -173,6 +173,18 @@ <i class="icon-down-open"/> </label> </div> + <div> + <input type="checkbox" id="hidePostStats" v-model="hidePostStatsLocal"> + <label for="hidePostStats"> + {{$t('settings.hide_post_stats')}} {{$t('settings.instance_default', { value: hidePostStatsDefault })}} + </label> + </div> + <div> + <input type="checkbox" id="hideUserStats" v-model="hideUserStatsLocal"> + <label for="hideUserStats"> + {{$t('settings.hide_user_stats')}} {{$t('settings.instance_default', { value: hideUserStatsDefault })}} + </label> + </div> </div> <div class="setting-item"> <p>{{$t('settings.filtering_explanation')}}</p> diff --git a/src/components/status/status.js b/src/components/status/status.js index 9c224ce3..10716583 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -31,10 +31,17 @@ const Status = { preview: null, showPreview: false, showingTall: false, - expandingSubject: !this.$store.state.config.collapseMessageWithSubject + expandingSubject: typeof this.$store.state.config.collapseMessageWithSubject === 'undefined' + ? !this.$store.state.instance.collapseMessageWithSubject + : !this.$store.state.config.collapseMessageWithSubject } }, computed: { + localCollapseSubjectDefault () { + return typeof this.$store.state.config.collapseMessageWithSubject === 'undefined' + ? this.$store.state.instance.collapseMessageWithSubject + : this.$store.state.config.collapseMessageWithSubject + }, muteWords () { return this.$store.state.config.muteWords }, @@ -147,13 +154,13 @@ const Status = { return this.status.attentions.length > 0 }, hideSubjectStatus () { - if (this.tallStatus && !this.$store.state.config.collapseMessageWithSubject) { + if (this.tallStatus && !this.localCollapseSubjectDefault) { return false } return !this.expandingSubject && this.status.summary }, hideTallStatus () { - if (this.status.summary && this.$store.state.config.collapseMessageWithSubject) { + if (this.status.summary && this.localCollapseSubjectDefault) { return false } if (this.showingTall) { @@ -168,7 +175,7 @@ const Status = { if (!this.status.nsfw) { return false } - if (this.status.summary && this.$store.state.config.collapseMessageWithSubject) { + if (this.status.summary && this.localCollapseSubjectDefault) { return false } return true diff --git a/src/components/user_card_content/user_card_content.js b/src/components/user_card_content/user_card_content.js index 76a5577e..b5dd9b91 100644 --- a/src/components/user_card_content/user_card_content.js +++ b/src/components/user_card_content/user_card_content.js @@ -3,6 +3,13 @@ import { hex2rgb } from '../../services/color_convert/color_convert.js' export default { props: [ 'user', 'switcher', 'selected', 'hideBio' ], + data () { + return { + hideUserStatsLocal: typeof this.$store.state.config.hideUserStats === 'undefined' + ? this.$store.state.instance.hideUserStats + : this.$store.state.config.hideUserStats + } + }, computed: { headingStyle () { const color = this.$store.state.config.colors.bg diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index 59358040..84669d7f 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -17,7 +17,7 @@ <div :title="user.name" class='user-name' v-else>{{user.name}}</div> <router-link class='user-screen-name':to="{ name: 'user-profile', params: { id: user.id } }"> <span>@{{user.screen_name}}</span><span v-if="user.locked"><i class="icon icon-lock"></i></span> - <span class="dailyAvg">{{dailyAvg}} {{ $t('user_card.per_day') }}</span> + <span v-if="!hideUserStatsLocal" class="dailyAvg">{{dailyAvg}} {{ $t('user_card.per_day') }}</span> </router-link> </div> </div> @@ -91,18 +91,18 @@ </div> </div> <div class="panel-body profile-panel-body"> - <div class="user-counts" :class="{clickable: switcher}"> + <div v-if="!hideUserStatsLocal || switcher" class="user-counts" :class="{clickable: switcher}"> <div class="user-count" v-on:click.prevent="setProfileView('statuses')" :class="{selected: selected === 'statuses'}"> <h5>{{ $t('user_card.statuses') }}</h5> - <span>{{user.statuses_count}} <br></span> + <span v-if="!hideUserStatsLocal">{{user.statuses_count}} <br></span> </div> <div class="user-count" v-on:click.prevent="setProfileView('friends')" :class="{selected: selected === 'friends'}"> <h5>{{ $t('user_card.followees') }}</h5> - <span>{{user.friends_count}}</span> + <span v-if="!hideUserStatsLocal">{{user.friends_count}}</span> </div> <div class="user-count" v-on:click.prevent="setProfileView('followers')" :class="{selected: selected === 'followers'}"> <h5>{{ $t('user_card.followers') }}</h5> - <span>{{user.followers_count}}</span> + <span v-if="!hideUserStatsLocal">{{user.followers_count}}</span> </div> </div> <p v-if="!hideBio && user.description_html" class="profile-bio" v-html="user.description_html"></p> |
