diff options
| author | Roger Braun <roger@rogerbraun.net> | 2017-01-01 18:12:20 +0100 |
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2017-01-01 18:12:20 +0100 |
| commit | 590782701df0e903e3193c827d5dd74244bdccf8 (patch) | |
| tree | 2d0591a4358cfc90b898b5c6449ee536e3139c41 /src/components/user_card_content/user_card_content.vue | |
| parent | c1d0b04105b34f10c1dc0c592d16228053ba39b1 (diff) | |
| parent | eac8fe0c337360ecc766b1920a8d868bd8291213 (diff) | |
Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma-fe into develop
Diffstat (limited to 'src/components/user_card_content/user_card_content.vue')
| -rw-r--r-- | src/components/user_card_content/user_card_content.vue | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index 7ad86e63..d9e661a9 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -6,6 +6,24 @@ <span class="glyphicon glyphicon-user"></span> <div class='user-name'>{{user.name}}</div> <div class='user-screen-name'>@{{user.screen_name}}</div> + <div v-if="isOtherUser" class="following-info"> + <div v-if="user.follows_you" class="following"> + Follows you! + </div> + <div class="followed"> + <span v-if="user.following"> + Following them! + <button @click="unfollowUser"> + Unfollow! + </button> + </span> + <span v-if="!user.following" > + <button @click="followUser"> + Follow! + </button> + </span> + </div> + </div> </div> </div> <div class="panel-body"> @@ -37,6 +55,21 @@ color: `#${this.user.profile_link_color}`, 'background-image': `url(${this.user.cover_photo})` } + }, + isOtherUser () { + return this.user !== this.$store.state.users.currentUser + } + }, + methods: { + followUser () { + const store = this.$store + store.state.api.backendInteractor.followUser(this.user.id) + .then((followedUser) => store.commit('addNewUsers', [followedUser])) + }, + unfollowUser () { + const store = this.$store + store.state.api.backendInteractor.unfollowUser(this.user.id) + .then((unfollowedUser) => store.commit('addNewUsers', [unfollowedUser])) } } } |
