Gate profileFields behind a feature

This commit is contained in:
Alex Gleason 2022-05-02 22:17:23 -05:00
parent 6ed1ead7ef
commit 300efe3259
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 21 additions and 10 deletions

View File

@ -435,16 +435,18 @@ const EditProfile: React.FC = () => {
)} )}
</div> </div>
<Streamfield {features.profileFields && (
labelText={<FormattedMessage id='edit_profile.fields.meta_fields_label' defaultMessage='Profile fields' />} <Streamfield
hintText={<FormattedMessage id='edit_profile.hints.meta_fields' defaultMessage='You can have up to {count, plural, one {# custom field} other {# custom fields}} displayed on your profile.' values={{ count: maxFields }} />} labelText={<FormattedMessage id='edit_profile.fields.meta_fields_label' defaultMessage='Profile fields' />}
values={data.fields_attributes || []} hintText={<FormattedMessage id='edit_profile.hints.meta_fields' defaultMessage='You can have up to {count, plural, one {# custom field} other {# custom fields}} displayed on your profile.' values={{ count: maxFields }} />}
onChange={handleFieldsChange} values={data.fields_attributes || []}
onAddItem={handleAddField} onChange={handleFieldsChange}
onRemoveItem={handleRemoveField} onAddItem={handleAddField}
component={ProfileField} onRemoveItem={handleRemoveField}
maxItems={maxFields} component={ProfileField}
/> maxItems={maxFields}
/>
)}
<FormActions> <FormActions>
<Button to='/settings' theme='ghost'> <Button to='/settings' theme='ghost'>

View File

@ -370,6 +370,15 @@ const getInstanceFeatures = (instance: Instance) => {
features.includes('profile_directory'), features.includes('profile_directory'),
]), ]),
/**
* Ability to set custom profile fields.
* @see PATCH /api/v1/accounts/update_credentials
*/
profileFields: any([
v.software === MASTODON,
v.software === PLEROMA,
]),
/** /**
* Can display a timeline of all known public statuses. * Can display a timeline of all known public statuses.
* Local and Fediverse timelines both use this feature. * Local and Fediverse timelines both use this feature.