StatusContainer: pass all props through, fix pinned posts not showing as pinned
This commit is contained in:
parent
19b6973667
commit
a0e79bfe10
3 changed files with 15 additions and 27 deletions
|
@ -181,7 +181,7 @@ const Status: React.FC<IStatus> = (props) => {
|
|||
};
|
||||
|
||||
if (!status) return null;
|
||||
let prepend, rebloggedByText, reblogElement, reblogElementMobile;
|
||||
let rebloggedByText, reblogElement, reblogElementMobile;
|
||||
|
||||
if (hidden) {
|
||||
return (
|
||||
|
@ -207,20 +207,6 @@ const Status: React.FC<IStatus> = (props) => {
|
|||
);
|
||||
}
|
||||
|
||||
if (featured) {
|
||||
prepend = (
|
||||
<div className='pt-4 px-4'>
|
||||
<HStack alignItems='center' space={1}>
|
||||
<Icon src={require('@tabler/icons/pinned.svg')} className='text-gray-600 dark:text-gray-400' />
|
||||
|
||||
<Text size='sm' theme='muted' weight='medium'>
|
||||
<FormattedMessage id='status.pinned' defaultMessage='Pinned post' />
|
||||
</Text>
|
||||
</HStack>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (status.reblog && typeof status.reblog === 'object') {
|
||||
const displayNameHtml = { __html: String(status.getIn(['account', 'display_name_html'])) };
|
||||
|
||||
|
@ -318,7 +304,17 @@ const Status: React.FC<IStatus> = (props) => {
|
|||
onClick={() => history.push(statusUrl)}
|
||||
role='link'
|
||||
>
|
||||
{prepend}
|
||||
{featured && (
|
||||
<div className='pt-4 px-4'>
|
||||
<HStack alignItems='center' space={1}>
|
||||
<Icon src={require('@tabler/icons/pinned.svg')} className='text-gray-600 dark:text-gray-400' />
|
||||
|
||||
<Text size='sm' theme='muted' weight='medium'>
|
||||
<FormattedMessage id='status.pinned' defaultMessage='Pinned post' />
|
||||
</Text>
|
||||
</HStack>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={classNames('status__wrapper', `status-${actualStatus.visibility}`, {
|
||||
|
|
|
@ -122,7 +122,6 @@ const StatusList: React.FC<IStatusList> = ({
|
|||
|
||||
const renderStatus = (statusId: string) => {
|
||||
return (
|
||||
// @ts-ignore
|
||||
<StatusContainer
|
||||
key={statusId}
|
||||
id={statusId}
|
||||
|
@ -157,7 +156,6 @@ const StatusList: React.FC<IStatusList> = ({
|
|||
if (!featuredStatusIds) return [];
|
||||
|
||||
return featuredStatusIds.toArray().map(statusId => (
|
||||
// @ts-ignore
|
||||
<StatusContainer
|
||||
key={`f-${statusId}`}
|
||||
id={statusId}
|
||||
|
|
|
@ -22,18 +22,12 @@ const getStatus = makeGetStatus();
|
|||
* Legacy Status wrapper accepting a status ID instead of the full entity.
|
||||
* @deprecated Use the Status component directly.
|
||||
*/
|
||||
const StatusContainer: React.FC<IStatusContainer> = ({ id, onMoveUp, onMoveDown, withDismiss }) => {
|
||||
const StatusContainer: React.FC<IStatusContainer> = (props) => {
|
||||
const { id, ...rest } = props;
|
||||
const status = useAppSelector(state => getStatus(state, { id }));
|
||||
|
||||
if (status) {
|
||||
return (
|
||||
<Status
|
||||
status={status}
|
||||
onMoveUp={onMoveUp}
|
||||
onMoveDown={onMoveDown}
|
||||
withDismiss={withDismiss}
|
||||
/>
|
||||
);
|
||||
return <Status status={status} {...rest} />;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue