AccountHeader: fix type of avatar and header media
This commit is contained in:
parent
965fd8e479
commit
0c1cda0afb
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
|
import { List as ImmutableList } from 'immutable';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { Link, useHistory } from 'react-router-dom';
|
import { Link, useHistory } from 'react-router-dom';
|
||||||
|
@ -23,6 +23,7 @@ import MovedNote from 'soapbox/features/account_timeline/components/moved_note';
|
||||||
import ActionButton from 'soapbox/features/ui/components/action-button';
|
import ActionButton from 'soapbox/features/ui/components/action-button';
|
||||||
import SubscriptionButton from 'soapbox/features/ui/components/subscription-button';
|
import SubscriptionButton from 'soapbox/features/ui/components/subscription-button';
|
||||||
import { useAppDispatch, useFeatures, useOwnAccount } from 'soapbox/hooks';
|
import { useAppDispatch, useFeatures, useOwnAccount } from 'soapbox/hooks';
|
||||||
|
import { normalizeAttachment } from 'soapbox/normalizers';
|
||||||
import { Account } from 'soapbox/types/entities';
|
import { Account } from 'soapbox/types/entities';
|
||||||
import { isRemote } from 'soapbox/utils/accounts';
|
import { isRemote } from 'soapbox/utils/accounts';
|
||||||
|
|
||||||
|
@ -207,12 +208,9 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onAvatarClick = () => {
|
const onAvatarClick = () => {
|
||||||
const avatar_url = account.avatar;
|
const avatar = normalizeAttachment({
|
||||||
const avatar = ImmutableMap({
|
|
||||||
type: 'image',
|
type: 'image',
|
||||||
preview_url: avatar_url,
|
url: account.avatar,
|
||||||
url: avatar_url,
|
|
||||||
description: '',
|
|
||||||
});
|
});
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList.of(avatar), index: 0 }));
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(avatar), index: 0 }));
|
||||||
};
|
};
|
||||||
|
@ -225,12 +223,9 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onHeaderClick = () => {
|
const onHeaderClick = () => {
|
||||||
const header_url = account.header;
|
const header = normalizeAttachment({
|
||||||
const header = ImmutableMap({
|
|
||||||
type: 'image',
|
type: 'image',
|
||||||
preview_url: header_url,
|
url: account.header,
|
||||||
url: header_url,
|
|
||||||
description: '',
|
|
||||||
});
|
});
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList.of(header), index: 0 }));
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(header), index: 0 }));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue