Respect filters for reply hints

This commit is contained in:
Lim Chee Aun 2024-02-28 15:04:01 +08:00
parent 3acfc00ec0
commit 52b60fa38b
2 changed files with 35 additions and 2 deletions

View file

@ -404,6 +404,24 @@
font-size: 90%;
line-height: var(--avatar-size);
}
.status-filtered-badge.badge-meta {
margin-top: 6px;
flex-direction: row;
gap: 0.5em;
color: var(--text-color);
border-color: var(--text-color);
background-color: var(--bg-blur-color);
max-width: 100%;
> span + span {
position: static;
&:empty {
display: none;
}
}
}
}
.status .container {

View file

@ -2405,13 +2405,21 @@ function StatusCompact({ sKey }) {
visibility,
content,
language,
filtered,
} = status;
if (sensitive || spoilerText) return null;
if (!content) return null;
const srKey = statusKey(id, instance);
const statusPeekText = statusPeek(status);
const filterContext = useContext(FilterContext);
const filterInfo = isFiltered(filtered, filterContext);
if (filterInfo?.action === 'hide') return null;
const filterTitleStr = filterInfo?.titlesStr || '';
return (
<article
class={`status compact-reply ${
@ -2427,7 +2435,14 @@ function StatusCompact({ sKey }) {
lang={language}
dir="auto"
>
{statusPeekText}
{filterInfo ? (
<b class="status-filtered-badge badge-meta" title={filterTitleStr}>
<span>Filtered</span>
<span>{filterTitleStr}</span>
</b>
) : (
statusPeekText
)}
</div>
</article>
);