aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_card
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/user_card')
-rw-r--r--src/components/user_card/user_card.js29
-rw-r--r--src/components/user_card/user_card.vue19
2 files changed, 17 insertions, 31 deletions
diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
index 80d15a27..197c61d5 100644
--- a/src/components/user_card/user_card.js
+++ b/src/components/user_card/user_card.js
@@ -1,4 +1,5 @@
import UserAvatar from '../user_avatar/user_avatar.vue'
+import RemoteFollow from '../remote_follow/remote_follow.vue'
import { hex2rgb } from '../../services/color_convert/color_convert.js'
import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
@@ -15,6 +16,9 @@ export default {
betterShadow: this.$store.state.interface.browserSupport.cssFilter
}
},
+ created () {
+ this.$store.dispatch('fetchUserRelationship', this.user.id)
+ },
computed: {
classes () {
return [{
@@ -96,7 +100,8 @@ export default {
}
},
components: {
- UserAvatar
+ UserAvatar,
+ RemoteFollow
},
methods: {
followUser () {
@@ -116,24 +121,16 @@ export default {
})
},
blockUser () {
- const store = this.$store
- store.state.api.backendInteractor.blockUser(this.user.id)
- .then((blockedUser) => {
- store.commit('addNewUsers', [blockedUser])
- store.commit('removeStatus', { timeline: 'friends', userId: this.user.id })
- store.commit('removeStatus', { timeline: 'public', userId: this.user.id })
- store.commit('removeStatus', { timeline: 'publicAndExternal', userId: this.user.id })
- })
+ this.$store.dispatch('blockUser', this.user.id)
},
unblockUser () {
- const store = this.$store
- store.state.api.backendInteractor.unblockUser(this.user.id)
- .then((unblockedUser) => store.commit('addNewUsers', [unblockedUser]))
+ this.$store.dispatch('unblockUser', this.user.id)
},
- toggleMute () {
- const store = this.$store
- store.commit('setMuted', {user: this.user, muted: !this.user.muted})
- store.state.api.backendInteractor.setUserMute(this.user)
+ muteUser () {
+ this.$store.dispatch('muteUser', this.user.id)
+ },
+ unmuteUser () {
+ this.$store.dispatch('unmuteUser', this.user.id)
},
setProfileView (v) {
if (this.switcher) {
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
index 690e1bde..3259d1c5 100644
--- a/src/components/user_card/user_card.vue
+++ b/src/components/user_card/user_card.vue
@@ -74,24 +74,18 @@
</div>
<div class='mute' v-if='isOtherUser && loggedIn'>
<span v-if='user.muted'>
- <button @click="toggleMute" class="pressed">
+ <button @click="unmuteUser" class="pressed">
{{ $t('user_card.muted') }}
</button>
</span>
<span v-if='!user.muted'>
- <button @click="toggleMute">
+ <button @click="muteUser">
{{ $t('user_card.mute') }}
</button>
</span>
</div>
- <div class="remote-follow" v-if='!loggedIn && user.is_local'>
- <form method="POST" :action='subscribeUrl'>
- <input type="hidden" name="nickname" :value="user.screen_name">
- <input type="hidden" name="profile" value="">
- <button click="submit" class="remote-button">
- {{ $t('user_card.remote_follow') }}
- </button>
- </form>
+ <div v-if='!loggedIn && user.is_local'>
+ <RemoteFollow :user="user" />
</div>
<div class='block' v-if='isOtherUser && loggedIn'>
<span v-if='user.statusnet_blocking'>
@@ -375,11 +369,6 @@
min-height: 28px;
}
- .remote-follow {
- max-width: 220px;
- min-height: 28px;
- }
-
.follow {
max-width: 220px;
min-height: 28px;