make relationships separate from users

This commit is contained in:
Shpuld Shpuldson 2020-04-21 23:27:51 +03:00
parent d5457c323a
commit 6bb75a3a6d
25 changed files with 112 additions and 81 deletions

View file

@ -9,7 +9,7 @@ import { mapGetters } from 'vuex'
export default {
props: [
'user', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered', 'allowZoomingAvatar'
'userId', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered', 'allowZoomingAvatar'
],
data () {
return {
@ -21,6 +21,12 @@ export default {
this.$store.dispatch('fetchUserRelationship', this.user.id)
},
computed: {
user () {
return this.$store.getters.findUser(this.userId)
},
relationship () {
return this.$store.state.users.relationships[this.userId] || {}
},
classes () {
return [{
'user-card-rounded-t': this.rounded === 'top', // set border-top-left-radius and border-top-right-radius

View file

@ -8,7 +8,9 @@
:style="style"
class="background-image"
/>
<div class="panel-heading">
<div
class="panel-heading"
>
<div class="user-info">
<div class="container">
<a
@ -69,6 +71,7 @@
<AccountActions
v-if="isOtherUser && loggedIn"
:user="user"
:relationship="relationship"
/>
</div>
<div class="bottom-line">
@ -92,7 +95,7 @@
</div>
<div class="user-meta">
<div
v-if="user.follows_you && loggedIn && isOtherUser"
v-if="relationship.followed_by && loggedIn && isOtherUser"
class="following"
>
{{ $t('user_card.follows_you') }}
@ -139,10 +142,10 @@
class="user-interactions"
>
<div class="btn-group">
<FollowButton :user="user" />
<template v-if="user.following">
<FollowButton :relationship="relationship" />
<template v-if="relationship.following">
<ProgressButton
v-if="!user.subscribed"
v-if="!relationship.subscribing"
class="btn btn-default"
:click="subscribeUser"
:title="$t('user_card.subscribe')"
@ -161,7 +164,7 @@
</div>
<div>
<button
v-if="user.muted"
v-if="relationship.muting"
class="btn btn-default btn-block toggled"
@click="unmuteUser"
>