Hide follow actions for own account

Signed-off-by: Julius Härtl <jus@bitgrid.net>
alpha1
Julius Härtl 2018-12-05 09:48:02 +01:00
rodzic 3232df7a8c
commit 8184dbd705
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4C614C6ED2CDE6DF
4 zmienionych plików z 25 dodań i 14 usunięć

Wyświetl plik

@ -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,

Wyświetl plik

@ -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: () => {} }

Wyświetl plik

@ -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
}
}
}

Wyświetl plik

@ -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)
})
}
}