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' import BasicUserCard from '../basic_user_card/basic_user_card.vue'
const BlockCard = { const BlockCard = {
@ -17,7 +19,10 @@ const BlockCard = {
return this.user.block_expires_at == null return this.user.block_expires_at == null
? this.$t('user_card.block_expires_forever') ? this.$t('user_card.block_expires_forever')
: this.$t('user_card.block_expires_at', [new Date(this.user.mute_expires_at).toLocaleString()]) : this.$t('user_card.block_expires_at', [new Date(this.user.mute_expires_at).toLocaleString()])
} },
...mapState({
blockExpirationSupported: state => state.instance.blockExpiration,
})
}, },
components: { components: {
BasicUserCard BasicUserCard
@ -25,12 +30,14 @@ const BlockCard = {
methods: { methods: {
unblockUser () { unblockUser () {
this.progress = true this.progress = true
this.$store.dispatch('unblockUser', this.user.id).then(() => { this.$store.dispatch('unblockUser', this.user.id)
this.progress = false
})
}, },
blockUser () { 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: { methods: {
unmuteUser () { unmuteUser () {
this.progress = true this.progress = true
this.$store.dispatch('unmuteUser', this.userId).then(() => { this.$store.dispatch('unmuteUser', this.userId)
this.progress = false
})
}, },
muteUser () { muteUser () {
this.$refs.timedMuteDialog.optionallyPrompt() this.$refs.timedMuteDialog.optionallyPrompt()