Make filtered status work for boosts too

This commit is contained in:
Lim Chee Aun 2023-03-26 15:09:45 +08:00
parent f5646fe8a8
commit 35a8641f16

View file

@ -1728,10 +1728,12 @@ function FilteredStatus({ status, filterInfo, instance, containerProps = {} }) {
account: { avatar, avatarStatic }, account: { avatar, avatarStatic },
createdAt, createdAt,
visibility, visibility,
reblog,
} = status; } = status;
const isReblog = !!reblog;
const filterTitleStr = filterInfo?.titlesStr || ''; const filterTitleStr = filterInfo?.titlesStr || '';
const createdAtDate = new Date(createdAt); const createdAtDate = new Date(createdAt);
const statusPeekText = statusPeek(status); const statusPeekText = statusPeek(status.reblog || status);
const [showPeek, setShowPeek] = useState(false); const [showPeek, setShowPeek] = useState(false);
const bindLongPress = useLongPress( const bindLongPress = useLongPress(
@ -1747,6 +1749,7 @@ function FilteredStatus({ status, filterInfo, instance, containerProps = {} }) {
return ( return (
<div <div
class={isReblog ? 'status-reblog' : ''}
{...containerProps} {...containerProps}
title={statusPeekText} title={statusPeekText}
onContextMenu={(e) => { onContextMenu={(e) => {
@ -1776,9 +1779,22 @@ function FilteredStatus({ status, filterInfo, instance, containerProps = {} }) {
alt={visibilityText[visibility]} alt={visibilityText[visibility]}
size="s" size="s"
/>{' '} />{' '}
{isReblog ? (
'boosted'
) : (
<RelativeTime datetime={createdAtDate} format="micro" /> <RelativeTime datetime={createdAtDate} format="micro" />
)}
</span>
<span class="status-filtered-info-2">
{isReblog && (
<>
<Avatar
url={reblog.account.avatarStatic || reblog.account.avatar}
/>{' '}
</>
)}
{statusPeekText}
</span> </span>
<span class="status-filtered-info-2">{statusPeekText}</span>
</span> </span>
</article> </article>
{!!showPeek && ( {!!showPeek && (