2017-08-22 03:25:01 +10:00
|
|
|
import UserCardContent from '../user_card_content/user_card_content.vue'
|
2018-12-14 03:57:11 +11:00
|
|
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
2017-08-22 03:25:01 +10:00
|
|
|
|
|
|
|
const UserCard = {
|
|
|
|
props: [
|
|
|
|
'user',
|
2018-06-07 10:58:44 +10:00
|
|
|
'showFollows',
|
|
|
|
'showApproval'
|
2017-08-22 03:25:01 +10:00
|
|
|
],
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
userExpanded: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
UserCardContent
|
|
|
|
},
|
2018-12-14 04:41:36 +11:00
|
|
|
computed: {
|
|
|
|
currentUser () { return this.$store.state.users.currentUser }
|
|
|
|
},
|
2017-08-22 03:25:01 +10:00
|
|
|
methods: {
|
|
|
|
toggleUserExpanded () {
|
|
|
|
this.userExpanded = !this.userExpanded
|
2018-06-07 10:58:44 +10:00
|
|
|
},
|
|
|
|
approveUser () {
|
|
|
|
this.$store.state.api.backendInteractor.approveUser(this.user.id)
|
2018-06-07 11:24:31 +10:00
|
|
|
this.$store.dispatch('removeFollowRequest', this.user)
|
2018-06-07 10:58:44 +10:00
|
|
|
},
|
|
|
|
denyUser () {
|
|
|
|
this.$store.state.api.backendInteractor.denyUser(this.user.id)
|
2018-06-07 11:24:31 +10:00
|
|
|
this.$store.dispatch('removeFollowRequest', this.user)
|
2017-08-22 03:25:01 +10:00
|
|
|
}
|
2018-12-14 03:57:11 +11:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
userProfileLink (user) {
|
|
|
|
return generateProfileLink(user.id, user.screen_name)
|
|
|
|
}
|
2017-08-22 03:25:01 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default UserCard
|