birth_date -> birthday, hide_birth_date -> show_birthday

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-01-23 12:53:48 +01:00
parent 97d09317ae
commit bae4455f8c
5 changed files with 17 additions and 17 deletions

View File

@ -9,7 +9,7 @@ import 'react-datepicker/dist/react-datepicker.css';
import { getFeatures } from 'soapbox/utils/features';
const messages = defineMessages({
birthDatePlaceholder: { id: 'edit_profile.fields.birth_date_placeholder', defaultMessage: 'Your birth date' },
birthDatePlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birth date' },
});
const mapStateToProps = state => {
@ -17,7 +17,7 @@ const mapStateToProps = state => {
return {
supportsBirthDates: features.birthDates,
minAge: state.getIn(['instance', 'pleroma', 'metadata', 'birth_date_min_age']),
minAge: state.getIn(['instance', 'pleroma', 'metadata', 'birthday_min_age']),
};
};

View File

@ -47,7 +47,7 @@ const mapStateToProps = (state, props) => ({
needsApproval: state.getIn(['instance', 'approval_required']),
supportsEmailList: getFeatures(state.get('instance')).emailList,
supportsAccountLookup: getFeatures(state.get('instance')).accountLookup,
birthDateRequired: state.getIn(['instance', 'pleroma', 'metadata', 'birth_date_required']),
birthDateRequired: state.getIn(['instance', 'pleroma', 'metadata', 'birthday_required']),
});
export default @connect(mapStateToProps)
@ -223,7 +223,7 @@ class RegistrationForm extends ImmutablePureComponent {
}
if (birthDate) {
params.set('birth_date', birthDate.toISOString().slice(0, 10));
params.set('birthday', birthDate.toISOString().slice(0, 10));
}
});

View File

@ -56,7 +56,7 @@ class Account extends ImmutablePureComponent {
if (!account) return null;
const birthDate = account.getIn(['pleroma', 'birth_date']);
const birthDate = account.getIn(['pleroma', 'birthday']);
if (!birthDate) return null;
const formattedBirthDate = intl.formatDate(birthDate, { day: 'numeric', month: 'short', year: 'numeric' });

View File

@ -50,7 +50,7 @@ const messages = defineMessages({
error: { id: 'edit_profile.error', defaultMessage: 'Profile update failed' },
bioPlaceholder: { id: 'edit_profile.fields.bio_placeholder', defaultMessage: 'Tell us about yourself.' },
displayNamePlaceholder: { id: 'edit_profile.fields.display_name_placeholder', defaultMessage: 'Name' },
birthDatePlaceholder: { id: 'edit_profile.fields.birth_date_placeholder', defaultMessage: 'Your birth date' },
birthDatePlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birth date' },
});
const makeMapStateToProps = () => {
@ -113,8 +113,8 @@ class EditProfile extends ImmutablePureComponent {
const strangerNotifications = account.getIn(['pleroma', 'notification_settings', 'block_from_strangers']);
const acceptsEmailList = account.getIn(['pleroma', 'accepts_email_list']);
const discoverable = account.getIn(['source', 'pleroma', 'discoverable']);
const birthDate = account.getIn(['pleroma', 'birth_date']);
const hideBirthDate = account.getIn(['pleroma', 'hide_birth_date']);
const birthDate = account.getIn(['pleroma', 'birthday']);
const showBirthDate = account.getIn(['source', 'pleroma', 'show_birthday']);
const initialState = account.withMutations(map => {
map.merge(map.get('source'));
@ -124,7 +124,7 @@ class EditProfile extends ImmutablePureComponent {
map.set('accepts_email_list', acceptsEmailList);
map.set('hide_network', hidesNetwork(account));
map.set('discoverable', discoverable);
map.set('hide_birth_date', hideBirthDate);
map.set('show_birthday', showBirthDate);
if (birthDate) map.set('birthDate', new Date(birthDate));
unescapeParams(map, ['display_name', 'bio']);
});
@ -166,8 +166,8 @@ class EditProfile extends ImmutablePureComponent {
hide_follows: state.hide_network,
hide_followers_count: state.hide_network,
hide_follows_count: state.hide_network,
birth_date: state.birthDate?.toISOString().slice(0, 10),
hide_birth_date: state.hide_birth_date,
birthday: state.birthDate?.toISOString().slice(0, 10),
show_birthday: state.show_birthday,
}, this.getFieldParams().toJS());
}
@ -286,7 +286,7 @@ class EditProfile extends ImmutablePureComponent {
rows={3}
/>
<BirthDateInput
hint={<FormattedMessage id='edit_profile.fields.birth_date_label' defaultMessage='Birth date' />}
hint={<FormattedMessage id='edit_profile.fields.birthday_label' defaultMessage='Birth date' />}
value={this.state.birthDate}
onChange={this.handleBirthDateChange}
/>
@ -345,10 +345,10 @@ class EditProfile extends ImmutablePureComponent {
onChange={this.handleCheckboxChange}
/>
{supportsBirthDates && <Checkbox
label={<FormattedMessage id='edit_profile.fields.hide_birth_date_label' defaultMessage='Hide my birth date' />}
hint={<FormattedMessage id='edit_profile.hints.hide_birth_date' defaultMessage='Your birth date will not be shown on your profile.' />}
name='hide_birth_date'
checked={this.state.hide_birth_date}
label={<FormattedMessage id='edit_profile.fields.show_birthday_label' defaultMessage='Show my birth date' />}
hint={<FormattedMessage id='edit_profile.hints.show_birthday' defaultMessage='Your birth date will be visible on your profile.' />}
name='show_birthday'
checked={this.state.show_birthday}
onChange={this.handleCheckboxChange}
/>}
{supportsEmailList && <Checkbox

View File

@ -83,7 +83,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
getBirthDate = () => {
const { account, intl } = this.props;
const birthDate = account.getIn(['pleroma', 'birth_date']);
const birthDate = account.getIn(['pleroma', 'birthday']);
if (!birthDate) return null;
const formattedBirthDate = intl.formatDate(birthDate, { day: 'numeric', month: 'long', year: 'numeric' });