yandere_fe/src/components/user_card/user_card.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-08-21 10:25:01 -07:00
import UserCardContent from '../user_card_content/user_card_content.vue'
import UserAvatar from '../user_avatar/user_avatar.vue'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
2017-08-21 10:25:01 -07:00
const UserCard = {
props: [
'user',
2018-06-06 17:58:44 -07:00
'showFollows',
'showApproval'
2017-08-21 10:25:01 -07:00
],
data () {
return {
userExpanded: false
}
},
components: {
UserCardContent,
UserAvatar
2017-08-21 10:25:01 -07:00
},
computed: {
currentUser () { return this.$store.state.users.currentUser }
},
2017-08-21 10:25:01 -07:00
methods: {
toggleUserExpanded () {
this.userExpanded = !this.userExpanded
2018-06-06 17:58:44 -07:00
},
approveUser () {
this.$store.state.api.backendInteractor.approveUser(this.user.id)
this.$store.dispatch('removeFollowRequest', this.user)
2018-06-06 17:58:44 -07:00
},
denyUser () {
this.$store.state.api.backendInteractor.denyUser(this.user.id)
this.$store.dispatch('removeFollowRequest', this.user)
2018-12-16 15:52:27 -08:00
},
userProfileLink (user) {
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
2017-08-21 10:25:01 -07:00
}
}
}
export default UserCard