refactor: blocks plugins (#1956)

This commit is contained in:
Mo
2022-11-08 13:31:48 -06:00
committed by GitHub
parent bfca244061
commit 70a9dbcea6
73 changed files with 1448 additions and 1049 deletions

View File

@@ -0,0 +1,16 @@
import { LinkableItem } from './LinkableItem'
export function isSearchResultAlreadyLinkedToItem(searchResult: LinkableItem, item: LinkableItem): boolean {
let isAlreadyLinked = false
const isItemReferencedByActiveItem = item.references.some((ref) => ref.uuid === searchResult.uuid)
const isActiveItemReferencedByItem = searchResult.references.some((ref) => ref.uuid === item?.uuid)
if (item.content_type === searchResult.content_type) {
isAlreadyLinked = isItemReferencedByActiveItem
} else {
isAlreadyLinked = isActiveItemReferencedByItem || isItemReferencedByActiveItem
}
return isAlreadyLinked
}