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, value: mode,
label: this.$t(`settings.third_column_mode_${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: loopSilentAvailable:
// Firefox // Firefox
Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') || Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') ||

View File

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

View File

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

View File

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

View File

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