commit
f883a8875d
@ -0,0 +1,35 @@
|
|||||||
|
import ProgressButton from '../progress_button/progress_button.vue'
|
||||||
|
|
||||||
|
const AccountActions = {
|
||||||
|
props: [
|
||||||
|
'user'
|
||||||
|
],
|
||||||
|
data () {
|
||||||
|
return { }
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
ProgressButton
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showRepeats () {
|
||||||
|
this.$store.dispatch('showReblogs', this.user.id)
|
||||||
|
},
|
||||||
|
hideRepeats () {
|
||||||
|
this.$store.dispatch('hideReblogs', this.user.id)
|
||||||
|
},
|
||||||
|
blockUser () {
|
||||||
|
this.$store.dispatch('blockUser', this.user.id)
|
||||||
|
},
|
||||||
|
unblockUser () {
|
||||||
|
this.$store.dispatch('unblockUser', this.user.id)
|
||||||
|
},
|
||||||
|
reportUser () {
|
||||||
|
this.$store.dispatch('openUserReportingModal', this.user.id)
|
||||||
|
},
|
||||||
|
mentionUser () {
|
||||||
|
this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AccountActions
|
@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<div class="account-actions">
|
||||||
|
<v-popover
|
||||||
|
trigger="click"
|
||||||
|
class="account-tools-popover"
|
||||||
|
:container="false"
|
||||||
|
placement="bottom-end"
|
||||||
|
:offset="5"
|
||||||
|
>
|
||||||
|
<div slot="popover">
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<button
|
||||||
|
class="btn btn-default btn-block dropdown-item"
|
||||||
|
@click="mentionUser"
|
||||||
|
>
|
||||||
|
{{ $t('user_card.mention') }}
|
||||||
|
</button>
|
||||||
|
<template v-if="user.following">
|
||||||
|
<div
|
||||||
|
role="separator"
|
||||||
|
class="dropdown-divider"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
v-if="user.showing_reblogs"
|
||||||
|
class="btn btn-default dropdown-item"
|
||||||
|
@click="hideRepeats"
|
||||||
|
>
|
||||||
|
{{ $t('user_card.hide_repeats') }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-if="!user.showing_reblogs"
|
||||||
|
class="btn btn-default dropdown-item"
|
||||||
|
@click="showRepeats"
|
||||||
|
>
|
||||||
|
{{ $t('user_card.show_repeats') }}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<div
|
||||||
|
role="separator"
|
||||||
|
class="dropdown-divider"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
v-if="user.statusnet_blocking"
|
||||||
|
class="btn btn-default btn-block dropdown-item"
|
||||||
|
@click="unblockUser"
|
||||||
|
>
|
||||||
|
{{ $t('user_card.unblock') }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="btn btn-default btn-block dropdown-item"
|
||||||
|
@click="blockUser"
|
||||||
|
>
|
||||||
|
{{ $t('user_card.block') }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-default btn-block dropdown-item"
|
||||||
|
@click="reportUser"
|
||||||
|
>
|
||||||
|
{{ $t('user_card.report') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="btn btn-default ellipsis-button">
|
||||||
|
<i class="icon-ellipsis trigger-button" />
|
||||||
|
</div>
|
||||||
|
</v-popover>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./account_actions.js"></script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '../../_variables.scss';
|
||||||
|
@import '../popper/popper.scss';
|
||||||
|
.account-actions {
|
||||||
|
margin: 0 .8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-actions button.dropdown-item {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
.account-actions .trigger-button {
|
||||||
|
color: $fallback--lightText;
|
||||||
|
color: var(--lightText, $fallback--lightText);
|
||||||
|
opacity: .8;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: $fallback--text;
|
||||||
|
color: var(--text, $fallback--text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,53 @@
|
|||||||
|
import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
|
||||||
|
export default {
|
||||||
|
props: ['user', 'labelFollowing', 'buttonClass'],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
inProgress: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isPressed () {
|
||||||
|
return this.inProgress || this.user.following
|
||||||
|
},
|
||||||
|
title () {
|
||||||
|
if (this.inProgress || this.user.following) {
|
||||||
|
return this.$t('user_card.follow_unfollow')
|
||||||
|
} else if (this.user.requested) {
|
||||||
|
return this.$t('user_card.follow_again')
|
||||||
|
} else {
|
||||||
|
return this.$t('user_card.follow')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label () {
|
||||||
|
if (this.inProgress) {
|
||||||
|
return this.$t('user_card.follow_progress')
|
||||||
|
} else if (this.user.following) {
|
||||||
|
return this.labelFollowing || this.$t('user_card.following')
|
||||||
|
} else if (this.user.requested) {
|
||||||
|
return this.$t('user_card.follow_sent')
|
||||||
|
} else {
|
||||||
|
return this.$t('user_card.follow')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onClick () {
|
||||||
|
this.user.following ? this.unfollow() : this.follow()
|
||||||
|
},
|
||||||
|
follow () {
|
||||||
|
this.inProgress = true
|
||||||
|
requestFollow(this.user, this.$store).then(() => {
|
||||||
|
this.inProgress = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
unfollow () {
|
||||||
|
const store = this.$store
|
||||||
|
this.inProgress = true
|
||||||
|
requestUnfollow(this.user, store).then(() => {
|
||||||
|
this.inProgress = false
|
||||||
|
store.commit('removeStatus', { timeline: 'friends', userId: this.user.id })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
<button
|
||||||
|
class="btn btn-default follow-button"
|
||||||
|
:class="{ pressed: isPressed }"
|
||||||
|
:disabled="inProgress"
|
||||||
|
:title="title"
|
||||||
|
@click="onClick"
|
||||||
|
>
|
||||||
|
{{ label }}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./follow_button.js"></script>
|
Loading…
Reference in new issue