2023-06-20 12:24:39 -07:00
|
|
|
import { Map as ImmutableMap, type Collection } from 'immutable';
|
2022-04-11 12:58:48 -07:00
|
|
|
|
2023-06-20 12:24:39 -07:00
|
|
|
import type { Status } from 'soapbox/schemas';
|
2022-04-11 12:58:48 -07:00
|
|
|
|
2023-06-20 12:24:39 -07:00
|
|
|
export const shouldFilter = (
|
|
|
|
status: Pick<Status, 'in_reply_to_id' | 'visibility'> & { reblog: unknown },
|
|
|
|
columnSettings: Collection<any, any>,
|
|
|
|
) => {
|
2022-04-11 12:58:48 -07:00
|
|
|
const shows = ImmutableMap({
|
2022-06-04 00:22:36 -07:00
|
|
|
reblog: status.reblog !== null,
|
|
|
|
reply: status.in_reply_to_id !== null,
|
|
|
|
direct: status.visibility === 'direct',
|
2022-04-11 12:58:48 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
return shows.some((value, key) => {
|
|
|
|
return columnSettings.getIn(['shows', key]) === false && value;
|
|
|
|
});
|
|
|
|
};
|