block/mute cards update to show expiry and ask for it
This commit is contained in:
parent
385f921c41
commit
8436f39eff
6 changed files with 48 additions and 47 deletions
|
|
@ -2,11 +2,6 @@ import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
||||||
|
|
||||||
const BlockCard = {
|
const BlockCard = {
|
||||||
props: ['userId'],
|
props: ['userId'],
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
progress: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
user () {
|
user () {
|
||||||
return this.$store.getters.findUser(this.userId)
|
return this.$store.getters.findUser(this.userId)
|
||||||
|
|
@ -16,6 +11,12 @@ const BlockCard = {
|
||||||
},
|
},
|
||||||
blocked () {
|
blocked () {
|
||||||
return this.relationship.blocking
|
return this.relationship.blocking
|
||||||
|
},
|
||||||
|
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()])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -29,10 +30,7 @@ const BlockCard = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
blockUser () {
|
blockUser () {
|
||||||
this.progress = true
|
this.$refs.timedBlockDialog.optionallyPrompt()
|
||||||
this.$store.dispatch('blockUser', this.user.id).then(() => {
|
|
||||||
this.progress = false
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,32 @@
|
||||||
<template>
|
<template>
|
||||||
<basic-user-card :user="user">
|
<basic-user-card :user="user">
|
||||||
<div class="block-card-content-container">
|
<div class="block-card-content-container">
|
||||||
|
<span v-if="blocked" class="alert neutral">
|
||||||
|
{{ blockExpiry }}
|
||||||
|
</span>
|
||||||
|
{{ ' ' }}
|
||||||
<button
|
<button
|
||||||
v-if="blocked"
|
v-if="blocked"
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
:disabled="progress"
|
|
||||||
@click="unblockUser"
|
@click="unblockUser"
|
||||||
>
|
>
|
||||||
<template v-if="progress">
|
|
||||||
{{ $t('user_card.unblock_progress') }}
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ $t('user_card.unblock') }}
|
{{ $t('user_card.unblock') }}
|
||||||
</template>
|
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-else
|
v-else
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
:disabled="progress"
|
|
||||||
@click="blockUser"
|
@click="blockUser"
|
||||||
>
|
>
|
||||||
<template v-if="progress">
|
|
||||||
{{ $t('user_card.block_progress') }}
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ $t('user_card.block') }}
|
{{ $t('user_card.block') }}
|
||||||
</template>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<teleport to="#modal">
|
||||||
|
<UserTimedFilterModal
|
||||||
|
:user="user"
|
||||||
|
:is-mute="false"
|
||||||
|
ref="timedBlockDialog"
|
||||||
|
/>
|
||||||
|
</teleport>
|
||||||
</basic-user-card>
|
</basic-user-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
||||||
|
import UserTimedFilterModal from 'src/components/user_timed_filter_modal/user_timed_filter_modal.vue'
|
||||||
|
|
||||||
const MuteCard = {
|
const MuteCard = {
|
||||||
props: ['userId'],
|
props: ['userId'],
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
progress: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
user () {
|
user () {
|
||||||
return this.$store.getters.findUser(this.userId)
|
return this.$store.getters.findUser(this.userId)
|
||||||
|
|
@ -16,10 +12,16 @@ const MuteCard = {
|
||||||
},
|
},
|
||||||
muted () {
|
muted () {
|
||||||
return this.relationship.muting
|
return this.relationship.muting
|
||||||
|
},
|
||||||
|
muteExpiry () {
|
||||||
|
return this.user.mute_expires_at == null
|
||||||
|
? this.$t('user_card.mute_expires_forever')
|
||||||
|
: this.$t('user_card.mute_expires_at', [new Date(this.user.mute_expires_at).toLocaleString()])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
BasicUserCard
|
BasicUserCard,
|
||||||
|
UserTimedFilterModal
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
unmuteUser () {
|
unmuteUser () {
|
||||||
|
|
@ -29,10 +31,7 @@ const MuteCard = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
muteUser () {
|
muteUser () {
|
||||||
this.progress = true
|
this.$refs.timedMuteDialog.optionallyPrompt()
|
||||||
this.$store.dispatch('muteUser', this.userId).then(() => {
|
|
||||||
this.progress = false
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,32 @@
|
||||||
<template>
|
<template>
|
||||||
<basic-user-card :user="user">
|
<basic-user-card :user="user">
|
||||||
<div class="mute-card-content-container">
|
<div class="mute-card-content-container">
|
||||||
|
<span v-if="muted" class="alert neutral">
|
||||||
|
{{ muteExpiry }}
|
||||||
|
</span>
|
||||||
|
{{ ' ' }}
|
||||||
<button
|
<button
|
||||||
v-if="muted"
|
v-if="muted"
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
:disabled="progress"
|
|
||||||
@click="unmuteUser"
|
@click="unmuteUser"
|
||||||
>
|
>
|
||||||
<template v-if="progress">
|
|
||||||
{{ $t('user_card.unmute_progress') }}
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ $t('user_card.unmute') }}
|
{{ $t('user_card.unmute') }}
|
||||||
</template>
|
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-else
|
v-else
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
:disabled="progress"
|
|
||||||
@click="muteUser"
|
@click="muteUser"
|
||||||
>
|
>
|
||||||
<template v-if="progress">
|
|
||||||
{{ $t('user_card.mute_progress') }}
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ $t('user_card.mute') }}
|
{{ $t('user_card.mute') }}
|
||||||
</template>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<teleport to="#modal">
|
||||||
|
<UserTimedFilterModal
|
||||||
|
:user="user"
|
||||||
|
:is-mute="true"
|
||||||
|
ref="timedMuteDialog"
|
||||||
|
/>
|
||||||
|
</teleport>
|
||||||
</basic-user-card>
|
</basic-user-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1412,6 +1412,10 @@
|
||||||
"dont_ask_again_block": "Always block users this way",
|
"dont_ask_again_block": "Always block users this way",
|
||||||
"mute_block_temporarily": "Temporarily",
|
"mute_block_temporarily": "Temporarily",
|
||||||
"mute_block_forever": "Forever",
|
"mute_block_forever": "Forever",
|
||||||
|
"mute_expires_forever": "Muted forever",
|
||||||
|
"mute_expires_at": "Muted until {0}",
|
||||||
|
"block_expires_forever": "Blocked forever",
|
||||||
|
"block_expires_at": "Blocked until {0}",
|
||||||
"mute_duration_prompt": "Mute this user for (0 for indefinite time):",
|
"mute_duration_prompt": "Mute this user for (0 for indefinite time):",
|
||||||
"per_day": "per day",
|
"per_day": "per day",
|
||||||
"remote_follow": "Remote follow",
|
"remote_follow": "Remote follow",
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ export const parseUser = (data) => {
|
||||||
output.screen_name = data.acct
|
output.screen_name = data.acct
|
||||||
output.fqn = data.fqn
|
output.fqn = data.fqn
|
||||||
output.statusnet_profile_url = data.url
|
output.statusnet_profile_url = data.url
|
||||||
|
output.mute_expires_at = data.mute_expires_at
|
||||||
|
output.block_expires_at = data.block_expires_at
|
||||||
|
|
||||||
// There's nothing else to get
|
// There's nothing else to get
|
||||||
if (mastoShort) {
|
if (mastoShort) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue