sforkowany z mirror/social
Profiles view is now able to load an account whose domain part is
a host-meta of the real domain. Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>feature/noid/sql-rewrite-0929
rodzic
eefa99f287
commit
128438e705
|
@ -108,13 +108,15 @@ const actions = {
|
|||
fetchAccountInfo(context, account) {
|
||||
return axios.get(OC.generateUrl(`apps/social/api/v1/global/account/info?account=${account}`)).then((response) => {
|
||||
context.commit('addAccount', { actorId: response.data.result.account.id, data: response.data.result.account })
|
||||
return response.data.result.account
|
||||
}).catch(() => {
|
||||
OC.Notification.showTemporary(`Failed to load account details ${account}`)
|
||||
})
|
||||
},
|
||||
fetchPublicAccountInfo(context, uid) {
|
||||
axios.get(OC.generateUrl(`apps/social/api/v1/account/${uid}/info`)).then((response) => {
|
||||
return axios.get(OC.generateUrl(`apps/social/api/v1/account/${uid}/info`)).then((response) => {
|
||||
context.commit('addAccount', { actorId: response.data.result.account.id, data: response.data.result.account })
|
||||
return response.data.result.account
|
||||
}).catch(() => {
|
||||
OC.Notification.showTemporary(`Failed to load account details ${uid}`)
|
||||
})
|
||||
|
|
|
@ -79,12 +79,22 @@ export default {
|
|||
}
|
||||
},
|
||||
beforeMount() {
|
||||
|
||||
let fetchMethod = ''
|
||||
this.uid = this.$route.params.account
|
||||
|
||||
// Are we authenticated?
|
||||
if (this.serverData.public) {
|
||||
this.$store.dispatch('fetchPublicAccountInfo', this.uid)
|
||||
fetchMethod = 'fetchPublicAccountInfo'
|
||||
} else {
|
||||
this.$store.dispatch('fetchAccountInfo', this.profileAccount)
|
||||
fetchMethod = 'fetchAccountInfo'
|
||||
}
|
||||
|
||||
// We need to update this.uid because we may have asked info for an account whose domain part was a host-meta,
|
||||
// and the account returned by the backend always uses a non host-meta'ed domain for its ID
|
||||
this.$store.dispatch(fetchMethod, this.profileAccount).then((response) => {
|
||||
this.uid = response.account
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue