From f7f0439e729f30bfaf8fd9e23211a5d68f596fba Mon Sep 17 00:00:00 2001 From: Mary Kate Date: Wed, 5 Aug 2020 12:47:45 -0500 Subject: [PATCH] prevent verified users from updating display name on frontend --- .../features/edit_profile/components/profile_preview.js | 8 +++++++- app/soapbox/features/edit_profile/index.js | 7 ++++++- app/styles/accounts.scss | 4 ++++ app/styles/forms.scss | 9 +++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/soapbox/features/edit_profile/components/profile_preview.js b/app/soapbox/features/edit_profile/components/profile_preview.js index 6b4166d22..faf3c04d3 100644 --- a/app/soapbox/features/edit_profile/components/profile_preview.js +++ b/app/soapbox/features/edit_profile/components/profile_preview.js @@ -2,6 +2,9 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { acctFull } from 'soapbox/utils/accounts'; import StillImage from 'soapbox/components/still_image'; +import VerificationBadge from 'soapbox/components/verification_badge'; + + const ProfilePreview = ({ account }) => (
@@ -16,7 +19,10 @@ const ProfilePreview = ({ account }) => (
{account.get('username')} - {account.get('display_name')} + + {account.get('display_name')} + {account.get('pleroma').get('tags').includes('verified') && } + {acctFull(account)}
diff --git a/app/soapbox/features/edit_profile/index.js b/app/soapbox/features/edit_profile/index.js index fce8e33df..5445ff30a 100644 --- a/app/soapbox/features/edit_profile/index.js +++ b/app/soapbox/features/edit_profile/index.js @@ -24,6 +24,7 @@ const messages = defineMessages({ heading: { id: 'column.edit_profile', defaultMessage: 'Edit profile' }, metaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder', defaultMessage: 'Label' }, 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 => { @@ -155,7 +156,8 @@ class EditProfile extends ImmutablePureComponent { } render() { - const { intl, maxFields } = this.props; + const { intl, maxFields, account } = this.props; + const verified = account.get('pleroma').get('tags').includes('verified'); return ( @@ -163,10 +165,13 @@ class EditProfile extends ImmutablePureComponent {
} name='display_name' value={this.state.display_name} onChange={this.handleTextChange} + disabled={verified} + hint={verified && intl.formatMessage(messages.verified)} /> } diff --git a/app/styles/accounts.scss b/app/styles/accounts.scss index b25f0d477..000cf75cb 100644 --- a/app/styles/accounts.scss +++ b/app/styles/accounts.scss @@ -92,6 +92,10 @@ overflow: hidden; text-overflow: ellipsis; } + + bdi, span.verified-icon { + display: inline-block; + } } } } diff --git a/app/styles/forms.scss b/app/styles/forms.scss index 6cf1f5f0f..96616c6ff 100644 --- a/app/styles/forms.scss +++ b/app/styles/forms.scss @@ -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 { label { color: lighten($error-red, 12%);