Merge branch 'fixes_for_deactivated_profile' into 'develop'

Improve the user card for deactivated users

See merge request pleroma/pleroma-fe!1417
This commit is contained in:
HJ 2022-01-19 13:09:49 +00:00
commit 6509542dbd
5 changed files with 20 additions and 4 deletions

View file

@ -1,6 +1,6 @@
import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
export default { export default {
props: ['relationship', 'labelFollowing', 'buttonClass'], props: ['relationship', 'user', 'labelFollowing', 'buttonClass'],
data () { data () {
return { return {
inProgress: false inProgress: false
@ -29,6 +29,9 @@ export default {
} else { } else {
return this.$t('user_card.follow') return this.$t('user_card.follow')
} }
},
disabled () {
return this.inProgress || this.user.deactivated
} }
}, },
methods: { methods: {

View file

@ -2,7 +2,7 @@
<button <button
class="btn button-default follow-button" class="btn button-default follow-button"
:class="{ toggled: isPressed }" :class="{ toggled: isPressed }"
:disabled="inProgress" :disabled="disabled"
:title="title" :title="title"
@click="onClick" @click="onClick"
> >

View file

@ -82,6 +82,12 @@
@{{ user.screen_name_ui }} @{{ user.screen_name_ui }}
</router-link> </router-link>
<template v-if="!hideBio"> <template v-if="!hideBio">
<span
v-if="user.deactivated"
class="alert user-role"
>
{{ $t('user_card.deactivated') }}
</span>
<span <span
v-if="!!visibleRole" v-if="!!visibleRole"
class="alert user-role" class="alert user-role"
@ -160,7 +166,10 @@
class="user-interactions" class="user-interactions"
> >
<div class="btn-group"> <div class="btn-group">
<FollowButton :relationship="relationship" /> <FollowButton
:relationship="relationship"
:user="user"
/>
<template v-if="relationship.following"> <template v-if="relationship.following">
<ProgressButton <ProgressButton
v-if="!relationship.subscribing" v-if="!relationship.subscribing"
@ -195,6 +204,7 @@
<button <button
v-if="relationship.muting" v-if="relationship.muting"
class="btn button-default btn-block toggled" class="btn button-default btn-block toggled"
:disabled="user.deactivated"
@click="unmuteUser" @click="unmuteUser"
> >
{{ $t('user_card.muted') }} {{ $t('user_card.muted') }}
@ -202,6 +212,7 @@
<button <button
v-else v-else
class="btn button-default btn-block" class="btn button-default btn-block"
:disabled="user.deactivated"
@click="muteUser" @click="muteUser"
> >
{{ $t('user_card.mute') }} {{ $t('user_card.mute') }}
@ -210,6 +221,7 @@
<div> <div>
<button <button
class="btn button-default btn-block" class="btn button-default btn-block"
:disabled="user.deactivated"
@click="mentionUser" @click="mentionUser"
> >
{{ $t('user_card.mention') }} {{ $t('user_card.mention') }}

View file

@ -727,6 +727,7 @@
"approve": "Approve", "approve": "Approve",
"block": "Block", "block": "Block",
"blocked": "Blocked!", "blocked": "Blocked!",
"deactivated": "Deactivated",
"deny": "Deny", "deny": "Deny",
"edit_profile": "Edit profile", "edit_profile": "Edit profile",
"favorites": "Favorites", "favorites": "Favorites",

View file

@ -393,7 +393,7 @@ const users = {
toggleActivationStatus ({ rootState, commit }, { user }) { toggleActivationStatus ({ rootState, commit }, { user }) {
const api = user.deactivated ? rootState.api.backendInteractor.activateUser : rootState.api.backendInteractor.deactivateUser const api = user.deactivated ? rootState.api.backendInteractor.activateUser : rootState.api.backendInteractor.deactivateUser
api({ user }) api({ user })
.then(({ deactivated }) => commit('updateActivationStatus', { user, deactivated })) .then((user) => { let deactivated = !user.is_active; commit('updateActivationStatus', { user, deactivated }) })
}, },
registerPushNotifications (store) { registerPushNotifications (store) {
const token = store.state.currentUser.credentials const token = store.state.currentUser.credentials