Modified endpoint to properly filter Bookmarks based on Hidden flag on both the Bookmark entry itself and its associated tags

This commit is contained in:
2023-02-20 22:48:52 -06:00
parent c55b018c0d
commit 83a4fba905
7 changed files with 57 additions and 84 deletions

View File

@ -1,5 +1,5 @@
import { isDev } from "./isDevHelper";
import { getTagGroups } from "./tagsHelper";
import { getTagGroups, flattenTagArrays } from "./tagsHelper";
import { isSubset } from "./arrayHelper";
import { containsSubstring } from "./bookmarkHelper";
@ -7,5 +7,6 @@ export {
isDev,
getTagGroups,
isSubset,
containsSubstring
containsSubstring,
flattenTagArrays
}

View File

@ -14,4 +14,12 @@ export const getTagGroups = (allBookmarkTags) => {
return accumulator
}, []).sort((a, b) => (a.name < b.name) ? -1 : (a.name > b.name) ? 1 : 0);
}
};
export const flattenTagArrays = (allBookmarkTags) => allBookmarkTags.flat().reduce((accumulator, current) => {
if(!accumulator.find((item) => item.id === current.id)) {
accumulator.push(current);
}
return accumulator
}, []);