pl-fe: WIP migrate settings store to zustand
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@ -1,18 +1,24 @@
|
||||
import { Map as ImmutableMap, type Collection } from 'immutable';
|
||||
import { Settings } from 'pl-fe/schemas/pl-fe/settings';
|
||||
|
||||
import type { Status } from 'pl-fe/normalizers';
|
||||
|
||||
const shouldFilter = (
|
||||
status: Pick<Status, 'in_reply_to_id' | 'visibility' | 'reblog_id'>,
|
||||
columnSettings: Collection<any, any>,
|
||||
columnSettings: Settings['timelines'][''],
|
||||
) => {
|
||||
const shows = ImmutableMap({
|
||||
const fallback = {
|
||||
reblog: true,
|
||||
reply: true,
|
||||
direct: false,
|
||||
};
|
||||
|
||||
const shows = {
|
||||
reblog: status.reblog_id !== null,
|
||||
reply: status.in_reply_to_id !== null,
|
||||
direct: status.visibility === 'direct',
|
||||
});
|
||||
};
|
||||
|
||||
return shows.some((value, key) => columnSettings.getIn(['shows', key]) === false && value);
|
||||
return Object.entries(shows).some(([key, value]) => (columnSettings?.shows || fallback)[key as 'reblog' | 'reply' | 'direct'] === false && value);
|
||||
};
|
||||
|
||||
export { shouldFilter };
|
||||
|
||||
Reference in New Issue
Block a user