prevent verified users from updating display name on frontend
This commit is contained in:
parent
c9b2b66283
commit
f7f0439e72
4 changed files with 26 additions and 2 deletions
|
@ -2,6 +2,9 @@ import React from 'react';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { acctFull } from 'soapbox/utils/accounts';
|
import { acctFull } from 'soapbox/utils/accounts';
|
||||||
import StillImage from 'soapbox/components/still_image';
|
import StillImage from 'soapbox/components/still_image';
|
||||||
|
import VerificationBadge from 'soapbox/components/verification_badge';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ProfilePreview = ({ account }) => (
|
const ProfilePreview = ({ account }) => (
|
||||||
<div className='card h-card'>
|
<div className='card h-card'>
|
||||||
|
@ -16,7 +19,10 @@ const ProfilePreview = ({ account }) => (
|
||||||
<div className='display-name'>
|
<div className='display-name'>
|
||||||
<span style={{ display: 'none' }}>{account.get('username')}</span>
|
<span style={{ display: 'none' }}>{account.get('username')}</span>
|
||||||
<bdi>
|
<bdi>
|
||||||
<strong className='emojify p-name'>{account.get('display_name')}</strong>
|
<strong className='emojify p-name'>
|
||||||
|
{account.get('display_name')}
|
||||||
|
{account.get('pleroma').get('tags').includes('verified') && <VerificationBadge />}
|
||||||
|
</strong>
|
||||||
</bdi>
|
</bdi>
|
||||||
<span>{acctFull(account)}</span>
|
<span>{acctFull(account)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,6 +24,7 @@ const messages = defineMessages({
|
||||||
heading: { id: 'column.edit_profile', defaultMessage: 'Edit profile' },
|
heading: { id: 'column.edit_profile', defaultMessage: 'Edit profile' },
|
||||||
metaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder', defaultMessage: 'Label' },
|
metaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder', defaultMessage: 'Label' },
|
||||||
metaFieldContent: { id: 'edit_profile.fields.meta_fields.content_placeholder', defaultMessage: 'Content' },
|
metaFieldContent: { id: 'edit_profile.fields.meta_fields.content_placeholder', defaultMessage: 'Content' },
|
||||||
|
verified: { id: 'edit_profile.fields.verified_display_name', defaultMessage: 'Verified users may not update their display name' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
|
@ -155,7 +156,8 @@ class EditProfile extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, maxFields } = this.props;
|
const { intl, maxFields, account } = this.props;
|
||||||
|
const verified = account.get('pleroma').get('tags').includes('verified');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column icon='user' heading={intl.formatMessage(messages.heading)} backBtnSlim>
|
<Column icon='user' heading={intl.formatMessage(messages.heading)} backBtnSlim>
|
||||||
|
@ -163,10 +165,13 @@ class EditProfile extends ImmutablePureComponent {
|
||||||
<fieldset disabled={this.state.isLoading}>
|
<fieldset disabled={this.state.isLoading}>
|
||||||
<FieldsGroup>
|
<FieldsGroup>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
className={verified && 'disabled'}
|
||||||
label={<FormattedMessage id='edit_profile.fields.display_name_label' defaultMessage='Display name' />}
|
label={<FormattedMessage id='edit_profile.fields.display_name_label' defaultMessage='Display name' />}
|
||||||
name='display_name'
|
name='display_name'
|
||||||
value={this.state.display_name}
|
value={this.state.display_name}
|
||||||
onChange={this.handleTextChange}
|
onChange={this.handleTextChange}
|
||||||
|
disabled={verified}
|
||||||
|
hint={verified && intl.formatMessage(messages.verified)}
|
||||||
/>
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
label={<FormattedMessage id='edit_profile.fields.bio_label' defaultMessage='Bio' />}
|
label={<FormattedMessage id='edit_profile.fields.bio_label' defaultMessage='Bio' />}
|
||||||
|
|
|
@ -92,6 +92,10 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bdi, span.verified-icon {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,6 +342,15 @@ code {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input[type=text][disabled],
|
||||||
|
input[type=number][disabled],
|
||||||
|
input[type=email][disabled],
|
||||||
|
input[type=password][disabled],
|
||||||
|
textarea {
|
||||||
|
color: var(--primary-text-color--faint);
|
||||||
|
border-color: var(--primary-text-color--faint);
|
||||||
|
}
|
||||||
|
|
||||||
.input.field_with_errors {
|
.input.field_with_errors {
|
||||||
label {
|
label {
|
||||||
color: lighten($error-red, 12%);
|
color: lighten($error-red, 12%);
|
||||||
|
|
Loading…
Reference in a new issue