From fad638342619504f2d941bd1c6a5d01f346291eb Mon Sep 17 00:00:00 2001
From: Kristina <kristin.fefelova@gmail.com>
Date: Wed, 3 Jul 2024 19:24:32 +0400
Subject: [PATCH] Remove wrong unused code (#5996)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
---
 plugins/activity-resources/src/references.ts | 92 --------------------
 1 file changed, 92 deletions(-)

diff --git a/plugins/activity-resources/src/references.ts b/plugins/activity-resources/src/references.ts
index da36affd42..2eadd90bb3 100644
--- a/plugins/activity-resources/src/references.ts
+++ b/plugins/activity-resources/src/references.ts
@@ -1,5 +1,4 @@
 import core, {
-  type Class,
   type Data,
   type Doc,
   type DocumentQuery,
@@ -76,94 +75,3 @@ export async function updateReferences (
 
   await updateReferencesList(client, query, references, space)
 }
-
-function extractReferences (
-  srcDocId: Ref<Doc>,
-  srcDocClass: Ref<Class<Doc>>,
-  attachedDocId: Ref<Doc> | undefined,
-  attachedDocClass: Ref<Class<Doc>> | undefined,
-  kids: NodeListOf<ChildNode>
-): Array<Data<ActivityReference>> {
-  const result: Array<Data<ActivityReference>> = []
-
-  const nodes: Array<NodeListOf<ChildNode>> = [kids]
-  while (true) {
-    const nds = nodes.shift()
-    if (nds === undefined) {
-      break
-    }
-    nds.forEach((kid) => {
-      if (
-        kid.nodeType === Node.ELEMENT_NODE &&
-        (kid as HTMLElement).localName === 'span' &&
-        (kid as HTMLElement).getAttribute('data-type') === 'reference'
-      ) {
-        const el = kid as HTMLElement
-        const ato = el.getAttribute('data-id') as Ref<Doc>
-        const atoClass = el.getAttribute('data-objectclass') as Ref<Class<Doc>>
-        const e = result.find((e) => e.attachedTo === ato && e.attachedToClass === atoClass)
-        if (e === undefined && ato !== attachedDocId && ato !== srcDocId) {
-          result.push({
-            attachedTo: ato,
-            attachedToClass: atoClass,
-            collection: 'references',
-            srcDocId,
-            srcDocClass,
-            message: el.parentElement?.innerHTML ?? '',
-            attachedDocId,
-            attachedDocClass
-          })
-        }
-      }
-      nodes.push(kid.childNodes)
-    })
-  }
-  return result
-}
-
-/**
- * @public
- */
-export function getReferences (
-  srcDocId: Ref<Doc>,
-  srcDocClass: Ref<Class<Doc>>,
-  attachedDocId: Ref<Doc> | undefined,
-  attachedDocClass: Ref<Class<Doc>> | undefined,
-  content: string
-): Array<Data<ActivityReference>> {
-  const parser = new DOMParser()
-  const doc = parser.parseFromString(content, 'text/html')
-
-  return extractReferences(
-    srcDocId,
-    srcDocClass,
-    attachedDocId,
-    attachedDocClass,
-    doc.childNodes as NodeListOf<HTMLElement>
-  )
-}
-
-/**
- * @public
- */
-export async function createReferences (
-  client: TxOperations,
-  srcDocId: Ref<Doc>,
-  srcDocClass: Ref<Class<Doc>>,
-  attachedDocId: Ref<Doc> | undefined,
-  attachedDocClass: Ref<Class<Doc>> | undefined,
-  content: string,
-  space: Ref<Space>
-): Promise<void> {
-  const hierarchy = client.getHierarchy()
-
-  const references = getReferences(srcDocId, srcDocClass, attachedDocId, attachedDocClass, content)
-  for (const ref of references) {
-    if (hierarchy.isDerived(ref.attachedToClass, contact.class.Person)) {
-      continue
-    }
-
-    const { attachedTo, attachedToClass, collection, ...adata } = ref
-    await client.addCollection(activity.class.ActivityReference, space, attachedTo, attachedToClass, collection, adata)
-  }
-}