sforkowany z mirror/social
Hide follow actions for own account
Signed-off-by: Julius Härtl <jus@bitgrid.net>alpha1
rodzic
3232df7a8c
commit
8184dbd705
|
@ -27,7 +27,7 @@
|
|||
<h2>{{ displayName }}</h2>
|
||||
<p>{{ accountInfo.account }}</p>
|
||||
<p v-if="accountInfo.website">Website: <a :href="accountInfo.website.value">{{ accountInfo.website.value }}</a></p>
|
||||
<template v-if="currentUser.uid !== accountInfo.preferredUsername">
|
||||
<template v-if="cloudId !== accountInfo.account">
|
||||
<button v-if="accountInfo.details && accountInfo.details.following" :class="{'icon-loading-small': followLoading}"
|
||||
@click="unfollow()"
|
||||
@mouseover="followingText=t('social', 'Unfollow')" @mouseleave="followingText=t('social', 'Following')">
|
||||
|
@ -100,7 +100,11 @@ export default {
|
|||
components: {
|
||||
Avatar
|
||||
},
|
||||
mixins: [serverData, currentUser, follow],
|
||||
mixins: [
|
||||
serverData,
|
||||
currentUser,
|
||||
follow
|
||||
],
|
||||
props: {
|
||||
uid: {
|
||||
type: String,
|
||||
|
|
|
@ -36,12 +36,14 @@
|
|||
<!-- TODO check where the html is coming from to avoid security issues -->
|
||||
<p v-html="item.summary" />
|
||||
</div>
|
||||
<button v-if="item.details && item.details.following" :class="{'icon-loading-small': followLoading}"
|
||||
@click="unfollow()"
|
||||
@mouseover="followingText=t('social', 'Unfollow')" @mouseleave="followingText=t('social', 'Following')">
|
||||
<span><span class="icon-checkmark" />{{ followingText }}</span></button>
|
||||
<button v-else-if="item.details" :class="{'icon-loading-small': followLoading}" class="primary"
|
||||
@click="follow"><span>{{ t('social', 'Follow') }}</span></button>
|
||||
<template v-if="cloudId !== item.account">
|
||||
<button v-if="item.details && item.details.following" :class="{'icon-loading-small': followLoading}"
|
||||
@click="unfollow()"
|
||||
@mouseover="followingText=t('social', 'Unfollow')" @mouseleave="followingText=t('social', 'Following')">
|
||||
<span><span class="icon-checkmark" />{{ followingText }}</span></button>
|
||||
<button v-else-if="item.details" :class="{'icon-loading-small': followLoading}" class="primary"
|
||||
@click="follow"><span>{{ t('social', 'Follow') }}</span></button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -49,6 +51,7 @@
|
|||
<script>
|
||||
import { Avatar } from 'nextcloud-vue'
|
||||
import follow from '../mixins/follow'
|
||||
import currentUser from '../mixins/currentUserMixin'
|
||||
|
||||
export default {
|
||||
name: 'UserEntry',
|
||||
|
@ -56,7 +59,8 @@ export default {
|
|||
Avatar
|
||||
},
|
||||
mixins: [
|
||||
follow
|
||||
follow,
|
||||
currentUser
|
||||
],
|
||||
props: {
|
||||
item: { type: Object, default: () => {} }
|
||||
|
|
|
@ -26,13 +26,16 @@ export default {
|
|||
serverData
|
||||
],
|
||||
computed: {
|
||||
currentUser: function() {
|
||||
currentUser() {
|
||||
return OC.getCurrentUser()
|
||||
},
|
||||
socialId: function() {
|
||||
socialId() {
|
||||
return '@' + this.cloudId
|
||||
},
|
||||
cloudId() {
|
||||
const url = document.createElement('a')
|
||||
url.setAttribute('href', this.serverData.cloudAddress)
|
||||
return '@' + OC.getCurrentUser().uid + '@' + url.hostname
|
||||
return this.currentUser.uid + '@' + url.hostname
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export default {
|
|||
}).catch((error) => {
|
||||
this.followLoading = false
|
||||
OC.Notification.showTemporary(`Failed to follow user ${this.item.account}`)
|
||||
console.error(`Failed to follow user ${this.item.account}`, error)
|
||||
console.error(`Failed to follow user ${this.item.account}`, error.response.data)
|
||||
})
|
||||
|
||||
},
|
||||
|
@ -63,7 +63,7 @@ export default {
|
|||
}).catch((error) => {
|
||||
this.followLoading = false
|
||||
OC.Notification.showTemporary(`Failed to unfollow user ${this.item.account}`)
|
||||
console.error(`Failed to unfollow user ${this.item.account}`, error)
|
||||
console.error(`Failed to unfollow user ${this.item.account}`, error.response.data)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue