Merge branch 'location' into 'develop'
Display account location on profile See merge request soapbox-pub/soapbox-fe!1064
This commit is contained in:
commit
f6c55a2e8f
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"id": "107759994408336377",
|
||||
"username": "alex",
|
||||
"acct": "alex",
|
||||
"display_name": "Alex G.",
|
||||
"locked": false,
|
||||
"bot": false,
|
||||
"discoverable": null,
|
||||
"group": false,
|
||||
"created_at": "2022-02-08T00:00:00.000Z",
|
||||
"note": "<p>Launching Truth Social</p>",
|
||||
"url": "https://truthsocial.com/@alex",
|
||||
"avatar": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/avatars/107/759/994/408/336/377/original/119cb0dd1fa615b7.png",
|
||||
"avatar_static": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/avatars/107/759/994/408/336/377/original/119cb0dd1fa615b7.png",
|
||||
"header": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/headers/107/759/994/408/336/377/original/31f62b0453ccf554.png",
|
||||
"header_static": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/headers/107/759/994/408/336/377/original/31f62b0453ccf554.png",
|
||||
"followers_count": 966,
|
||||
"following_count": 39,
|
||||
"statuses_count": 4,
|
||||
"last_status_at": "2022-02-20",
|
||||
"verified": true,
|
||||
"location": "Texas",
|
||||
"website": "https://soapbox.pub",
|
||||
"emojis": [],
|
||||
"fields": []
|
||||
}
|
|
@ -196,6 +196,13 @@ class ProfileInfoPanel extends ImmutablePureComponent {
|
|||
|
||||
{this.getBirthday()}
|
||||
|
||||
{account.get('location') && (
|
||||
<div className='profile-info-panel-content__location'>
|
||||
<Icon src={require('@tabler/icons/icons/map-pin.svg')} />
|
||||
{account.get('location')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!!account.getIn(['relationship', 'note']) && (
|
||||
<a href='#' className='profile-info-panel-content__note' onClick={this.handleShowNote}>
|
||||
<Icon src={require('@tabler/icons/icons/note.svg')} />
|
||||
|
|
|
@ -54,4 +54,16 @@ describe('normalizeAccount()', () => {
|
|||
const result = normalizeAccount(account);
|
||||
expect(result.get('verified')).toBe(true);
|
||||
});
|
||||
|
||||
it('normalizes Fedibird location', () => {
|
||||
const account = fromJS(require('soapbox/__fixtures__/fedibird-account.json'));
|
||||
const result = normalizeAccount(account);
|
||||
expect(result.get('location')).toBe('Texas, USA');
|
||||
});
|
||||
|
||||
it('normalizes Truth Social location', () => {
|
||||
const account = fromJS(require('soapbox/__fixtures__/truthsocial-account.json'));
|
||||
const result = normalizeAccount(account);
|
||||
expect(result.get('location')).toBe('Texas');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -38,10 +38,21 @@ const normalizeVerified = account => {
|
|||
});
|
||||
};
|
||||
|
||||
// Normalize Fedibird/Truth Social location
|
||||
const normalizeLocation = account => {
|
||||
return account.update('location', location => {
|
||||
return [
|
||||
location,
|
||||
account.getIn(['other_settings', 'location']),
|
||||
].find(Boolean);
|
||||
});
|
||||
};
|
||||
|
||||
export const normalizeAccount = account => {
|
||||
return account.withMutations(account => {
|
||||
normalizePleromaLegacyFields(account);
|
||||
normalizeVerified(account);
|
||||
normalizeBirthday(account);
|
||||
normalizeLocation(account);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
&__join-date,
|
||||
&__birthday,
|
||||
&__location,
|
||||
&__note {
|
||||
display: flex;
|
||||
font-size: 14px;
|
||||
|
|
Loading…
Reference in New Issue