mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 14:13:21 +01:00
Fix filter logic
This commit is contained in:
parent
6685549d11
commit
5208df4a28
1 changed files with 5 additions and 3 deletions
|
@ -13,8 +13,10 @@ export function filteredItem(item, filterContext, currentAccountID) {
|
||||||
return new Date(filter.expiresAt) > new Date();
|
return new Date(filter.expiresAt) > new Date();
|
||||||
});
|
});
|
||||||
const isHidden = appliedFilters.some((f) => f.filter.filterAction === 'hide');
|
const isHidden = appliedFilters.some((f) => f.filter.filterAction === 'hide');
|
||||||
console.log({ isHidden, filtered, appliedFilters });
|
console.log({ isHidden, filtered, appliedFilters, item });
|
||||||
if (!isHidden) {
|
if (isHidden) return false;
|
||||||
|
const isWarn = appliedFilters.some((f) => f.filter.filterAction === 'warn');
|
||||||
|
if (isWarn) {
|
||||||
const filterTitles = appliedFilters.map((f) => f.filter.title);
|
const filterTitles = appliedFilters.map((f) => f.filter.title);
|
||||||
item._filtered = {
|
item._filtered = {
|
||||||
titles: filterTitles,
|
titles: filterTitles,
|
||||||
|
@ -22,7 +24,7 @@ export function filteredItem(item, filterContext, currentAccountID) {
|
||||||
};
|
};
|
||||||
item._test = { test: 'test' };
|
item._test = { test: 'test' };
|
||||||
}
|
}
|
||||||
return !isHidden;
|
return isWarn;
|
||||||
}
|
}
|
||||||
export function filteredItems(items, filterContext) {
|
export function filteredItems(items, filterContext) {
|
||||||
if (!items?.length) return [];
|
if (!items?.length) return [];
|
||||||
|
|
Loading…
Add table
Reference in a new issue