Treat reserved users like external users in the frontend.
This commit is contained in:
parent
24eba26c5b
commit
f35dbaf064
10 changed files with 21 additions and 9 deletions
|
@ -165,6 +165,8 @@ const afterStoreSetup = ({ store, i18n }) => {
|
||||||
store.dispatch('setInstanceOption', { name: 'chatAvailable', value: features.includes('chat') })
|
store.dispatch('setInstanceOption', { name: 'chatAvailable', value: features.includes('chat') })
|
||||||
store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') })
|
store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') })
|
||||||
|
|
||||||
|
store.dispatch('setInstanceOption', { name: 'restrictedNicknames', value: metadata.restrictedNicknames })
|
||||||
|
|
||||||
const suggestions = metadata.suggestions
|
const suggestions = metadata.suggestions
|
||||||
store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled })
|
store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled })
|
||||||
store.dispatch('setInstanceOption', { name: 'suggestionsWeb', value: suggestions.web })
|
store.dispatch('setInstanceOption', { name: 'suggestionsWeb', value: suggestions.web })
|
||||||
|
|
|
@ -22,7 +22,7 @@ const chatPanel = {
|
||||||
this.collapsed = !this.collapsed
|
this.collapsed = !this.collapsed
|
||||||
},
|
},
|
||||||
userProfileLink (user) {
|
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
|
this.userExpanded = !this.userExpanded
|
||||||
},
|
},
|
||||||
userProfileLink (user) {
|
userProfileLink (user) {
|
||||||
return generateProfileLink(user.id, user.screen_name)
|
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -291,7 +291,7 @@ const Status = {
|
||||||
this.showPreview = false
|
this.showPreview = false
|
||||||
},
|
},
|
||||||
userProfileLink (id, name) {
|
userProfileLink (id, name) {
|
||||||
return generateProfileLink(id, name)
|
return generateProfileLink(id, name, this.$store.state.instance.restrictedNicknames)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
|
@ -33,7 +33,7 @@ const UserCard = {
|
||||||
this.$store.dispatch('removeFollowRequest', this.user)
|
this.$store.dispatch('removeFollowRequest', this.user)
|
||||||
},
|
},
|
||||||
userProfileLink (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) {
|
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: {
|
methods: {
|
||||||
userProfileLink (id, name) {
|
userProfileLink (id, name) {
|
||||||
return generateProfileLink(id, name)
|
return generateProfileLink(id, name, this.$store.state.instance.restrictedNicknames)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
|
@ -32,6 +32,7 @@ const defaultState = {
|
||||||
pleromaBackend: true,
|
pleromaBackend: true,
|
||||||
emoji: [],
|
emoji: [],
|
||||||
customEmoji: [],
|
customEmoji: [],
|
||||||
|
restrictedNicknames: [],
|
||||||
|
|
||||||
// Feature-set, apparently, not everything here is reported...
|
// Feature-set, apparently, not everything here is reported...
|
||||||
mediaProxyAvailable: false,
|
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 {
|
return {
|
||||||
name: (isExternal(screenName) ? 'external-user-profile' : 'user-profile'),
|
name: (complicated ? 'external-user-profile' : 'user-profile'),
|
||||||
params: (isExternal(screenName) ? { id } : { name: screenName })
|
params: (complicated ? { id } : { name: screenName })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,10 @@ describe('generateProfileLink', () => {
|
||||||
name: 'external-user-profile', params: { id: 1 }
|
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 a new issue