From 2257612b1223e80a0c6e7e7e7c6bd1c407fa665f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 26 Feb 2022 22:49:42 +0100 Subject: [PATCH] Fedibird birthdays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/features/birthdays/account.js | 2 +- app/soapbox/features/edit_profile/index.js | 2 +- .../ui/components/profile_info_panel.js | 2 +- app/soapbox/reducers/accounts.js | 19 +++++++++++++------ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/soapbox/features/birthdays/account.js b/app/soapbox/features/birthdays/account.js index d0961d0ae..e79273f89 100644 --- a/app/soapbox/features/birthdays/account.js +++ b/app/soapbox/features/birthdays/account.js @@ -56,7 +56,7 @@ class Account extends ImmutablePureComponent { if (!account) return null; - const birthday = account.getIn(['pleroma', 'birthday']); + const birthday = account.get('birthday'); if (!birthday) return null; const formattedBirthday = intl.formatDate(birthday, { day: 'numeric', month: 'short', year: 'numeric' }); diff --git a/app/soapbox/features/edit_profile/index.js b/app/soapbox/features/edit_profile/index.js index ad1197555..5205f4eb6 100644 --- a/app/soapbox/features/edit_profile/index.js +++ b/app/soapbox/features/edit_profile/index.js @@ -114,7 +114,7 @@ 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 birthday = account.getIn(['pleroma', 'birthday']); + const birthday = account.get('birthday'); const showBirthday = account.getIn(['source', 'pleroma', 'show_birthday']); const initialState = account.withMutations(map => { diff --git a/app/soapbox/features/ui/components/profile_info_panel.js b/app/soapbox/features/ui/components/profile_info_panel.js index 8cd4dfb5d..e9066e09b 100644 --- a/app/soapbox/features/ui/components/profile_info_panel.js +++ b/app/soapbox/features/ui/components/profile_info_panel.js @@ -83,7 +83,7 @@ class ProfileInfoPanel extends ImmutablePureComponent { getBirthday = () => { const { account, intl } = this.props; - const birthday = account.getIn(['pleroma', 'birthday']); + const birthday = account.get('birthday'); if (!birthday) return null; const formattedBirthday = intl.formatDate(birthday, { timeZone: 'UTC', day: 'numeric', month: 'long', year: 'numeric' }); diff --git a/app/soapbox/reducers/accounts.js b/app/soapbox/reducers/accounts.js index c8b52dd37..4ccb82856 100644 --- a/app/soapbox/reducers/accounts.js +++ b/app/soapbox/reducers/accounts.js @@ -48,12 +48,19 @@ const normalizePleroma = account => { }; const normalizeAccount = (state, account) => { - const normalized = fromJS(normalizePleroma(account)).deleteAll([ - 'followers_count', - 'following_count', - 'statuses_count', - 'source', - ]); + const normalized = fromJS(normalizePleroma(account)).withMutations(account => { + account.deleteAll([ + 'followers_count', + 'following_count', + 'statuses_count', + 'source', + ]); + account.set( + 'birthday', + account.getIn(['pleroma', 'birthday'], account.getIn(['other_settings', 'birthday'])), + ); + }); + return state.set(account.id, normalized); };