Treat reserved users like external users in the frontend.
This commit is contained in:
parent
24eba26c5b
commit
f35dbaf064
|
@ -165,6 +165,8 @@ const afterStoreSetup = ({ store, i18n }) => {
|
|||
store.dispatch('setInstanceOption', { name: 'chatAvailable', value: features.includes('chat') })
|
||||
store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') })
|
||||
|
||||
store.dispatch('setInstanceOption', { name: 'restrictedNicknames', value: metadata.restrictedNicknames })
|
||||
|
||||
const suggestions = metadata.suggestions
|
||||
store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled })
|
||||
store.dispatch('setInstanceOption', { name: 'suggestionsWeb', value: suggestions.web })
|
||||
|
|
|
@ -22,7 +22,7 @@ const chatPanel = {
|
|||
this.collapsed = !this.collapsed
|
||||
},
|
||||
userProfileLink (user) {
|
||||
return generateProfileLink(user.id, user.screen_name)
|
||||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ const Notification = {
|
|||
this.userExpanded = !this.userExpanded
|
||||
},
|
||||
userProfileLink (user) {
|
||||
return generateProfileLink(user.id, user.screen_name)
|
||||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -291,7 +291,7 @@ const Status = {
|
|||
this.showPreview = false
|
||||
},
|
||||
userProfileLink (id, name) {
|
||||
return generateProfileLink(id, name)
|
||||
return generateProfileLink(id, name, this.$store.state.instance.restrictedNicknames)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -33,7 +33,7 @@ const UserCard = {
|
|||
this.$store.dispatch('removeFollowRequest', this.user)
|
||||
},
|
||||
userProfileLink (user) {
|
||||
return generateProfileLink(user.id, user.screen_name)
|
||||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ export default {
|
|||
}
|
||||
},
|
||||
userProfileLink (user) {
|
||||
return generateProfileLink(user.id, user.screen_name)
|
||||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ const WhoToFollowPanel = {
|
|||
},
|
||||
methods: {
|
||||
userProfileLink (id, name) {
|
||||
return generateProfileLink(id, name)
|
||||
return generateProfileLink(id, name, this.$store.state.instance.restrictedNicknames)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -32,6 +32,7 @@ const defaultState = {
|
|||
pleromaBackend: true,
|
||||
emoji: [],
|
||||
customEmoji: [],
|
||||
restrictedNicknames: [],
|
||||
|
||||
// Feature-set, apparently, not everything here is reported...
|
||||
mediaProxyAvailable: false,
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
const generateProfileLink = (id, screenName) => {
|
||||
import { includes } from 'lodash'
|
||||
|
||||
const generateProfileLink = (id, screenName, restrictedNicknames) => {
|
||||
const complicated = (isExternal(screenName) || includes(restrictedNicknames, screenName))
|
||||
return {
|
||||
name: (isExternal(screenName) ? 'external-user-profile' : 'user-profile'),
|
||||
params: (isExternal(screenName) ? { id } : { name: screenName })
|
||||
name: (complicated ? 'external-user-profile' : 'user-profile'),
|
||||
params: (complicated ? { id } : { name: screenName })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,4 +12,10 @@ describe('generateProfileLink', () => {
|
|||
name: 'external-user-profile', params: { id: 1 }
|
||||
})
|
||||
})
|
||||
|
||||
it('returns obj for restricted user', () => {
|
||||
expect(generateProfileLink(1, 'lain', ['lain'])).to.eql({
|
||||
name: 'external-user-profile', params: { id: 1 }
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue