Support email list

merge-requests/527/head
Alex Gleason 3 years ago
parent 0cd0eb6787
commit 6255ba4976
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -78,11 +78,13 @@ class EditProfile extends ImmutablePureComponent {
super(props);
const { account } = this.props;
const strangerNotifications = account.getIn(['pleroma', 'notification_settings', 'block_from_strangers']);
const acceptsEmailList = account.getIn(['pleroma', 'accepts_email_list']);
const initialState = account.withMutations(map => {
map.merge(map.get('source'));
map.delete('source');
map.set('fields', normalizeFields(map.get('fields'), props.maxFields));
map.set('stranger_notifications', strangerNotifications);
map.set('accepts_email_list', acceptsEmailList);
unescapeParams(map, ['display_name', 'bio']);
});
this.state = initialState.toObject();
@ -117,6 +119,7 @@ class EditProfile extends ImmutablePureComponent {
avatar: state.avatar_file,
header: state.header_file,
locked: state.locked,
accepts_email_list: state.accepts_email_list,
}, this.getFieldParams().toJS());
}
@ -246,6 +249,13 @@ class EditProfile extends ImmutablePureComponent {
checked={this.state.stranger_notifications}
onChange={this.handleCheckboxChange}
/>
<Checkbox
label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />}
hint={<FormattedMessage id='edit_profile.hints.accepts_email_list' defaultMessage='Opt-in to news and marketing updates.' />}
name='accepts_email_list'
checked={this.state.accepts_email_list}
onChange={this.handleCheckboxChange}
/>
</FieldsGroup>
<FieldsGroup>
<div className='fields-row__column fields-group'>

@ -28,6 +28,7 @@ const messages = defineMessages({
agreement: { id: 'registration.agreement', defaultMessage: 'I agree to the {tos}.' },
tos: { id: 'registration.tos', defaultMessage: 'Terms of Service' },
close: { id: 'registration.confirmation_modal.close', defaultMessage: 'Close' },
newsletter: { id: 'registration.newsletter', defaultMessage: 'Subscribe to newsletter.' },
});
const mapStateToProps = (state, props) => ({
@ -232,6 +233,11 @@ class RegistrationForm extends ImmutablePureComponent {
onChange={this.onCheckboxChange}
required
/>
<Checkbox
label={intl.formatMessage(messages.newsletter)}
name='accepts_email_list'
onChange={this.onCheckboxChange}
/>
</div>
<div className='actions'>
<button name='button' type='submit' className='btn button button-primary'>

Loading…
Cancel
Save