add ability to set with replies as default view

This commit is contained in:
FloatingGhost 2022-09-05 17:40:04 +01:00
parent c301daa276
commit 7350f5ad52
5 changed files with 24 additions and 6 deletions

View File

@ -43,6 +43,11 @@ const GeneralTab = {
value: mode,
label: this.$t(`settings.third_column_mode_${mode}`)
})),
userProfileDefaultTabOptions: ['statuses', 'replies'].map(tab => ({
key: tab,
value: tab,
label: this.$t(`user_card.${tab}`)
})),
loopSilentAvailable:
// Firefox
Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') ||

View File

@ -156,6 +156,15 @@
</li>
</ul>
</li>
<li>
<ChoiceSetting
id="userProfileDefaultTab"
path="userProfileDefaultTab"
:options="userProfileDefaultTabOptions"
>
{{ $t('settings.user_profile_default_tab') }}
</ChoiceSetting>
</li>
<li>
<ChoiceSetting
v-if="user && (translationLanguages.length > 0)"

View File

@ -33,22 +33,21 @@ const FriendList = withLoadMore({
additionalPropNames: ['userId']
})(List)
const defaultTabKey = 'statuses'
const UserProfile = {
data () {
return {
error: false,
userId: null,
tab: defaultTabKey,
tab: 'statuses',
footerRef: null,
note: null,
noteLoading: false
}
},
created () {
const defaultTabKey = this.defaultTabKey
const routeParams = this.$route.params
const hash = get(this.$route, 'hash', defaultTabKey).replace(/^#/, '')
const hash = (get(this.$route, 'hash') || defaultTabKey).replace(/^#/, '')
if (hash !== '') this.tab = hash
this.load(routeParams.name || routeParams.id)
},
@ -86,6 +85,9 @@ const UserProfile = {
},
currentUser () {
return this.$store.state.users.currentUser
},
defaultTabKey () {
return this.$store.getters.mergedConfig.userProfileDefaultTab || 'statuses'
}
},
methods: {
@ -191,7 +193,7 @@ const UserProfile = {
},
'$route.hash': function (newVal) {
const oldTab = this.tab
this.tab = newVal.replace(/^#/, '') || defaultTabKey
this.tab = newVal.replace(/^#/, '') || this.defaultTabKey
this.onRouteChange(oldTab, this.tab)
}
},

View File

@ -806,6 +806,7 @@
"use_one_click_nsfw": "Open NSFW attachments with just one click",
"user_mutes": "Users",
"user_profiles": "User Profiles",
"user_profile_default_tab": "Default Tab on User Profile",
"user_settings": "User Settings",
"valid_until": "Valid until",
"values": {

View File

@ -116,7 +116,8 @@ export const defaultState = {
conversationTreeFadeAncestors: undefined, // instance default
maxDepthInThread: undefined, // instance default
translationLanguage: undefined, // instance default,
supportedTranslationLanguages: {} // instance default
supportedTranslationLanguages: {}, // instance default
userProfileDefaultTab: 'statuses'
}
// caching the instance default properties