Skip to content

Commit

Permalink
fix: filter if reblogged post
Browse files Browse the repository at this point in the history
  • Loading branch information
cutls committed Sep 20, 2024
1 parent 969abfd commit b6056b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions renderer/components/timelines/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,12 @@ export default function TimelineColumn(props: Props) {
overscan={TIMELINE_STATUSES_COUNT}
defaultItemHeight={44}
itemContent={(_, status) => {
if (props.timeline.mediaOnly && status.media_attachments.length === 0) return null
const statusHasContent = status.reblog ? status.reblog : status
if (props.timeline.mediaOnly && statusHasContent.media_attachments.length === 0) return null
if (
filters
?.map((f) => [f.phrase, f.irreversible] as [string, boolean])
.findIndex(([keyword, irreversible]) => (irreversible ? status.content.toLowerCase().includes(keyword.toLowerCase()) : false)) > 0
.findIndex(([keyword, irreversible]) => (irreversible ? statusHasContent.content.toLowerCase().includes(keyword.toLowerCase()) : false)) >= 0
)
return null
return (
Expand Down
2 changes: 1 addition & 1 deletion renderer/components/timelines/status/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const Status: React.FC<Props> = (props) => {
const res = await props.client.getStatus(props.status.id)
props.updateStatus(res.data)
}
if (!ignoreFilter && props.filters?.map((f) => f.phrase).filter((keyword) => props.status.content.toLowerCase().includes(keyword.toLowerCase())).length > 0) {
if (!ignoreFilter && props.filters?.map((f) => f.phrase).filter((keyword) => status.content.toLowerCase().includes(keyword.toLowerCase())).length > 0) {
return (
<div className="status" style={{ textAlign: 'center', paddingTop: '0.5em', paddingBottom: '0.5em' }}>
<FormattedMessage id="timeline.status.filtered" />
Expand Down

0 comments on commit b6056b2

Please sign in to comment.