summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-09-26 12:32:49 +0200
committerGitHub <noreply@github.com>2019-09-26 12:32:49 +0200
commite0e26d9a4971406c9e68c94a8c7800a31dc73fcd (patch)
tree2b3ecee914b7b76a21e62686a36728dbc1a038f3 /src
parentf5c43764858b484ad6b91b7575c7bfcb5d568bab (diff)
parent2f7683a0aed54b45d304c324314bf36ad1f6916a (diff)
Merge pull request #746 from nextcloud/bugfix/745/social-address-on-local-account
check social address during local actor
Diffstat (limited to 'src')
-rw-r--r--src/components/ProfileInfo.vue6
-rw-r--r--src/components/TimelinePost.vue2
-rw-r--r--src/store/account.js4
-rw-r--r--src/views/Profile.vue14
4 files changed, 21 insertions, 5 deletions
diff --git a/src/components/ProfileInfo.vue b/src/components/ProfileInfo.vue
index 83a9b627..c7451f6b 100644
--- a/src/components/ProfileInfo.vue
+++ b/src/components/ProfileInfo.vue
@@ -23,7 +23,7 @@
<template>
<div v-if="account && accountInfo" class="user-profile">
<div>
- <avatar v-if="accountInfo.local" :user="uid" :disable-tooltip="true"
+ <avatar v-if="accountInfo.local" :user="localUid" :disable-tooltip="true"
:size="128" />
<avatar v-else :url="avatarUrl" :disable-tooltip="true"
:size="128" />
@@ -125,6 +125,10 @@ export default {
}
},
computed: {
+ localUid() {
+ // Returns only the local part of a username
+ return (this.uid.indexOf('@') === -1) ? this.uid : this.uid.substr(0, this.uid.indexOf('@'))
+ },
account() {
return (this.uid.indexOf('@') === -1) ? this.uid + '@' + this.hostname : this.uid
},
diff --git a/src/components/TimelinePost.vue b/src/components/TimelinePost.vue
index 6c86b936..aee1437e 100644
--- a/src/components/TimelinePost.vue
+++ b/src/components/TimelinePost.vue
@@ -37,7 +37,7 @@
<div v-if="hasAttachments" class="post-attachments">
<post-attachment :attachments="item.attachment" />
</div>
- <div v-if="this.$route.params.type!=='notifications'" v-click-outside="hidePopoverMenu" class="post-actions">
+ <div v-if="this.$route.params.type!=='notifications' && !serverData.public" v-click-outside="hidePopoverMenu" class="post-actions">
<a v-tooltip.bottom="t('social', 'Reply')" class="icon-reply" @click.prevent="reply" />
<a v-if="item.actor_info.account !== cloudId" v-tooltip.bottom="t('social', 'Boost')"
:class="(isBoosted) ? 'icon-boosted' : 'icon-boost'"
diff --git a/src/store/account.js b/src/store/account.js
index 76ea4679..e54d8c82 100644
--- a/src/store/account.js
+++ b/src/store/account.js
@@ -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}`)
})
diff --git a/src/views/Profile.vue b/src/views/Profile.vue
index 45db4dd7..109dd9d0 100644
--- a/src/views/Profile.vue
+++ b/src/views/Profile.vue
@@ -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: {
}