akkoma-fe/src/components/user_card/user_card.js
Henry Jameson 81c83566cd Merge remote-tracking branch 'upstream/develop' into user-profile-overhault
* upstream/develop: (24 commits)
  Feature/bigger icons for mobile / #211
  Fix oauth url
  Make user profile page cleaner
  Redirect to /main/all
  Move userProfile link to methods
  Fix user profile test
  Add temporary redirects
  Add local profile test
  Implement user_profile.spec.js
  Use babel polyfill in karma
  Use 'userProfileLink' to generate user-profile link
  Rollback disableDotRule
  Use "-1" in indexOf
  Add generateProfileLink
  Use "~" as a route namespace symbol
  Disable dot rule
  Pass userName instead of userId
  Typo in tests
  Fix redirect paths
  Fix typo
  ...
2018-12-18 22:43:26 +03:00

41 lines
1 KiB
JavaScript

import UserCardContent from '../user_card_content/user_card_content.vue'
import StillImage from '../still-image/still-image.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,
StillImage
},
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