aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_card/user_card.js
blob: ea893567a633c8d401a21ef24cf5fb3f67703cf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import UserCardContent from '../user_card_content/user_card_content.vue'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'

const UserCard = {
  props: [
    'user',
    'showFollows',
    'showApproval'
  ],
  data () {
    return {
      userExpanded: false
    }
  },
  components: {
    UserCardContent
  },
  computed: {
    currentUser () { return this.$store.state.users.currentUser }
  },
  methods: {
    toggleUserExpanded () {
      this.userExpanded = !this.userExpanded
    },
    approveUser () {
      this.$store.state.api.backendInteractor.approveUser(this.user.id)
      this.$store.dispatch('removeFollowRequest', this.user)
    },
    denyUser () {
      this.$store.state.api.backendInteractor.denyUser(this.user.id)
      this.$store.dispatch('removeFollowRequest', this.user)
    },
    userProfileLink (user) {
      return generateProfileLink(user.id, user.screen_name)
    }
  }
}

export default UserCard