StatusContainer: pass all props through, fix pinned posts not showing as pinned
This commit is contained in:
parent
19b6973667
commit
a0e79bfe10
|
@ -181,7 +181,7 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!status) return null;
|
if (!status) return null;
|
||||||
let prepend, rebloggedByText, reblogElement, reblogElementMobile;
|
let rebloggedByText, reblogElement, reblogElementMobile;
|
||||||
|
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
return (
|
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') {
|
if (status.reblog && typeof status.reblog === 'object') {
|
||||||
const displayNameHtml = { __html: String(status.getIn(['account', 'display_name_html'])) };
|
const displayNameHtml = { __html: String(status.getIn(['account', 'display_name_html'])) };
|
||||||
|
|
||||||
|
@ -318,7 +304,17 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
onClick={() => history.push(statusUrl)}
|
onClick={() => history.push(statusUrl)}
|
||||||
role='link'
|
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
|
<div
|
||||||
className={classNames('status__wrapper', `status-${actualStatus.visibility}`, {
|
className={classNames('status__wrapper', `status-${actualStatus.visibility}`, {
|
||||||
|
|
|
@ -122,7 +122,6 @@ const StatusList: React.FC<IStatusList> = ({
|
||||||
|
|
||||||
const renderStatus = (statusId: string) => {
|
const renderStatus = (statusId: string) => {
|
||||||
return (
|
return (
|
||||||
// @ts-ignore
|
|
||||||
<StatusContainer
|
<StatusContainer
|
||||||
key={statusId}
|
key={statusId}
|
||||||
id={statusId}
|
id={statusId}
|
||||||
|
@ -157,7 +156,6 @@ const StatusList: React.FC<IStatusList> = ({
|
||||||
if (!featuredStatusIds) return [];
|
if (!featuredStatusIds) return [];
|
||||||
|
|
||||||
return featuredStatusIds.toArray().map(statusId => (
|
return featuredStatusIds.toArray().map(statusId => (
|
||||||
// @ts-ignore
|
|
||||||
<StatusContainer
|
<StatusContainer
|
||||||
key={`f-${statusId}`}
|
key={`f-${statusId}`}
|
||||||
id={statusId}
|
id={statusId}
|
||||||
|
|
|
@ -22,18 +22,12 @@ const getStatus = makeGetStatus();
|
||||||
* Legacy Status wrapper accepting a status ID instead of the full entity.
|
* Legacy Status wrapper accepting a status ID instead of the full entity.
|
||||||
* @deprecated Use the Status component directly.
|
* @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 }));
|
const status = useAppSelector(state => getStatus(state, { id }));
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
return (
|
return <Status status={status} {...rest} />;
|
||||||
<Status
|
|
||||||
status={status}
|
|
||||||
onMoveUp={onMoveUp}
|
|
||||||
onMoveDown={onMoveDown}
|
|
||||||
withDismiss={withDismiss}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue