better support for lack of block expiration

This commit is contained in:
Henry Jameson 2025-07-09 17:56:52 +03:00
commit 71d1baffcc
2 changed files with 13 additions and 8 deletions

View file

@ -1,3 +1,5 @@
import { mapState } from 'vuex'
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
const BlockCard = {
@ -17,7 +19,10 @@ const BlockCard = {
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()])
}
},
...mapState({
blockExpirationSupported: state => state.instance.blockExpiration,
})
},
components: {
BasicUserCard
@ -25,12 +30,14 @@ const BlockCard = {
methods: {
unblockUser () {
this.progress = true
this.$store.dispatch('unblockUser', this.user.id).then(() => {
this.progress = false
})
this.$store.dispatch('unblockUser', this.user.id)
},
blockUser () {
this.$refs.timedBlockDialog.optionallyPrompt()
if (this.blockExpirationSupported) {
this.$refs.timedBlockDialog.optionallyPrompt()
} else {
this.$store.dispatch('blockUser', this.user.id)
}
}
}
}

View file

@ -26,9 +26,7 @@ const MuteCard = {
methods: {
unmuteUser () {
this.progress = true
this.$store.dispatch('unmuteUser', this.userId).then(() => {
this.progress = false
})
this.$store.dispatch('unmuteUser', this.userId)
},
muteUser () {
this.$refs.timedMuteDialog.optionallyPrompt()