2025-07-09 17:56:52 +03:00
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
|
2019-02-13 14:55:02 -05:00
|
|
|
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
|
|
|
|
|
|
|
|
|
const BlockCard = {
|
2019-02-13 15:31:20 -05:00
|
|
|
props: ['userId'],
|
|
|
|
|
computed: {
|
|
|
|
|
user () {
|
2019-03-08 22:40:57 +02:00
|
|
|
return this.$store.getters.findUser(this.userId)
|
2019-02-13 15:31:20 -05:00
|
|
|
},
|
2020-04-21 23:27:51 +03:00
|
|
|
relationship () {
|
2020-04-24 18:53:17 +03:00
|
|
|
return this.$store.getters.relationship(this.userId)
|
2020-04-21 23:27:51 +03:00
|
|
|
},
|
2019-02-13 15:31:20 -05:00
|
|
|
blocked () {
|
2020-04-21 23:27:51 +03:00
|
|
|
return this.relationship.blocking
|
2025-07-09 17:45:13 +03:00
|
|
|
},
|
|
|
|
|
blockExpiry () {
|
|
|
|
|
console.log(this.user)
|
|
|
|
|
return this.user.block_expires_at == null
|
|
|
|
|
? this.$t('user_card.block_expires_forever')
|
|
|
|
|
: this.$t('user_card.block_expires_at', [new Date(this.user.mute_expires_at).toLocaleString()])
|
2025-07-09 17:56:52 +03:00
|
|
|
},
|
|
|
|
|
...mapState({
|
|
|
|
|
blockExpirationSupported: state => state.instance.blockExpiration,
|
|
|
|
|
})
|
2019-02-13 14:55:02 -05:00
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
BasicUserCard
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
unblockUser () {
|
|
|
|
|
this.progress = true
|
2025-07-09 17:56:52 +03:00
|
|
|
this.$store.dispatch('unblockUser', this.user.id)
|
2019-02-13 15:31:20 -05:00
|
|
|
},
|
|
|
|
|
blockUser () {
|
2025-07-09 17:56:52 +03:00
|
|
|
if (this.blockExpirationSupported) {
|
|
|
|
|
this.$refs.timedBlockDialog.optionallyPrompt()
|
|
|
|
|
} else {
|
|
|
|
|
this.$store.dispatch('blockUser', this.user.id)
|
|
|
|
|
}
|
2019-02-13 14:55:02 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default BlockCard
|