2024-10-06 16:32:55 -07:00
|
|
|
import { Settings } from 'pl-fe/schemas/pl-fe/settings';
|
2022-04-11 12:58:48 -07:00
|
|
|
|
2024-08-28 04:41:08 -07:00
|
|
|
import type { Status } from 'pl-fe/normalizers';
|
2022-04-11 12:58:48 -07:00
|
|
|
|
2024-05-12 16:18:04 -07:00
|
|
|
const shouldFilter = (
|
2024-08-18 08:50:56 -07:00
|
|
|
status: Pick<Status, 'in_reply_to_id' | 'visibility' | 'reblog_id'>,
|
2024-10-06 16:32:55 -07:00
|
|
|
columnSettings: Settings['timelines'][''],
|
2023-06-20 12:24:39 -07:00
|
|
|
) => {
|
2024-10-06 16:32:55 -07:00
|
|
|
const fallback = {
|
|
|
|
reblog: true,
|
|
|
|
reply: true,
|
|
|
|
direct: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
const shows = {
|
2024-08-18 08:50:56 -07:00
|
|
|
reblog: status.reblog_id !== null,
|
2022-06-04 00:22:36 -07:00
|
|
|
reply: status.in_reply_to_id !== null,
|
|
|
|
direct: status.visibility === 'direct',
|
2024-10-06 16:32:55 -07:00
|
|
|
};
|
2022-04-11 12:58:48 -07:00
|
|
|
|
2024-10-06 16:32:55 -07:00
|
|
|
return Object.entries(shows).some(([key, value]) => (columnSettings?.shows || fallback)[key as 'reblog' | 'reply' | 'direct'] === false && value);
|
2022-04-11 12:58:48 -07:00
|
|
|
};
|
2024-05-12 16:18:04 -07:00
|
|
|
|
|
|
|
export { shouldFilter };
|