Merge branch 'next-conditional-profile' into 'next'
Next: EditProfile: conditional features See merge request soapbox-pub/soapbox-fe!1232
This commit is contained in:
commit
9f962ccec3
2 changed files with 38 additions and 29 deletions
|
@ -56,12 +56,13 @@ const makeMapStateToProps = () => {
|
||||||
const me = state.get('me');
|
const me = state.get('me');
|
||||||
const account = getAccount(state, me);
|
const account = getAccount(state, me);
|
||||||
const soapbox = getSoapboxConfig(state);
|
const soapbox = getSoapboxConfig(state);
|
||||||
|
const features = getFeatures(state.instance);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
account,
|
account,
|
||||||
|
features,
|
||||||
maxFields: state.getIn(['instance', 'pleroma', 'metadata', 'fields_limits', 'max_fields'], 4),
|
maxFields: state.getIn(['instance', 'pleroma', 'metadata', 'fields_limits', 'max_fields'], 4),
|
||||||
verifiedCanEditName: soapbox.get('verifiedCanEditName'),
|
verifiedCanEditName: soapbox.get('verifiedCanEditName'),
|
||||||
supportsEmailList: getFeatures(state.get('instance')).emailList,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -242,7 +243,7 @@ class EditProfile extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, account, verifiedCanEditName, supportsEmailList /* maxFields */ } = this.props;
|
const { intl, account, verifiedCanEditName, features /* maxFields */ } = this.props;
|
||||||
const verified = account.get('verified');
|
const verified = account.get('verified');
|
||||||
const canEditName = verifiedCanEditName || !verified;
|
const canEditName = verifiedCanEditName || !verified;
|
||||||
|
|
||||||
|
@ -262,27 +263,31 @@ class EditProfile extends ImmutablePureComponent {
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup
|
{features.accountLocation && (
|
||||||
labelText={<FormattedMessage id='edit_profile.fields.location_label' defaultMessage='Location' />}
|
<FormGroup
|
||||||
>
|
labelText={<FormattedMessage id='edit_profile.fields.location_label' defaultMessage='Location' />}
|
||||||
<Input
|
>
|
||||||
name='location'
|
<Input
|
||||||
value={this.state.location}
|
name='location'
|
||||||
onChange={this.handleTextChange}
|
value={this.state.location}
|
||||||
placeholder={intl.formatMessage(messages.locationPlaceholder)}
|
onChange={this.handleTextChange}
|
||||||
/>
|
placeholder={intl.formatMessage(messages.locationPlaceholder)}
|
||||||
</FormGroup>
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
)}
|
||||||
|
|
||||||
<FormGroup
|
{features.accountWebsite && (
|
||||||
labelText={<FormattedMessage id='edit_profile.fields.website_label' defaultMessage='Website' />}
|
<FormGroup
|
||||||
>
|
labelText={<FormattedMessage id='edit_profile.fields.website_label' defaultMessage='Website' />}
|
||||||
<Input
|
>
|
||||||
name='website'
|
<Input
|
||||||
value={this.state.website}
|
name='website'
|
||||||
onChange={this.handleTextChange}
|
value={this.state.website}
|
||||||
placeholder={intl.formatMessage(messages.websitePlaceholder)}
|
onChange={this.handleTextChange}
|
||||||
/>
|
placeholder={intl.formatMessage(messages.websitePlaceholder)}
|
||||||
</FormGroup>
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
)}
|
||||||
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
labelText={<FormattedMessage id='edit_profile.fields.bio_label' defaultMessage='Bio' />}
|
labelText={<FormattedMessage id='edit_profile.fields.bio_label' defaultMessage='Bio' />}
|
||||||
|
@ -351,13 +356,15 @@ class EditProfile extends ImmutablePureComponent {
|
||||||
checked={this.state.discoverable}
|
checked={this.state.discoverable}
|
||||||
onChange={this.handleCheckboxChange}
|
onChange={this.handleCheckboxChange}
|
||||||
/>*/}
|
/>*/}
|
||||||
{supportsEmailList && <Checkbox
|
{features.emailList && (
|
||||||
label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />}
|
<Checkbox
|
||||||
hint={<FormattedMessage id='edit_profile.hints.accepts_email_list' defaultMessage='Opt-in to news and marketing updates.' />}
|
label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />}
|
||||||
name='accepts_email_list'
|
hint={<FormattedMessage id='edit_profile.hints.accepts_email_list' defaultMessage='Opt-in to news and marketing updates.' />}
|
||||||
checked={this.state.accepts_email_list}
|
name='accepts_email_list'
|
||||||
onChange={this.handleCheckboxChange}
|
checked={this.state.accepts_email_list}
|
||||||
/>}
|
onChange={this.handleCheckboxChange}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{/* </FieldsGroup> */}
|
{/* </FieldsGroup> */}
|
||||||
{/*<FieldsGroup>
|
{/*<FieldsGroup>
|
||||||
<div className='fields-row__column fields-group'>
|
<div className='fields-row__column fields-group'>
|
||||||
|
|
|
@ -142,6 +142,8 @@ const getInstanceFeatures = (instance: Instance) => {
|
||||||
trendingTruths: v.software === TRUTHSOCIAL,
|
trendingTruths: v.software === TRUTHSOCIAL,
|
||||||
trendingStatuses: v.software === MASTODON && gte(v.compatVersion, '3.5.0'),
|
trendingStatuses: v.software === MASTODON && gte(v.compatVersion, '3.5.0'),
|
||||||
pepe: v.software === TRUTHSOCIAL,
|
pepe: v.software === TRUTHSOCIAL,
|
||||||
|
accountLocation: v.software === TRUTHSOCIAL,
|
||||||
|
accountWebsite: v.software === TRUTHSOCIAL,
|
||||||
|
|
||||||
// FIXME: long-term this shouldn't be a feature,
|
// FIXME: long-term this shouldn't be a feature,
|
||||||
// but for now we want it to be overrideable in the build
|
// but for now we want it to be overrideable in the build
|
||||||
|
|
Loading…
Reference in a new issue