UBER-769 Implement backlinks in server plugin (#3626)

Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2023-08-24 22:53:18 +07:00
committed by GitHub
parent 821ed6cd7b
commit 2c585b2ecd
41 changed files with 813 additions and 132 deletions
@@ -14,7 +14,7 @@
-->
<script lang="ts">
import { AttachmentStyledBox } from '@hcengineering/attachment-resources'
import chunter, { createBacklinks } from '@hcengineering/chunter'
import chunter from '@hcengineering/chunter'
import { Employee } from '@hcengineering/contact'
import core, { Account, AttachedData, Doc, fillDefaults, generateId, Ref, SortingOrder } from '@hcengineering/core'
import { getResource, translate } from '@hcengineering/platform'
@@ -429,9 +429,6 @@
}
)
// Create an backlink to document
await createBacklinks(client, _id, tracker.class.Issue, _id, object.description)
draftController.remove()
resetObject()
descriptionBox?.removeDraft(false)
@@ -1,6 +1,5 @@
<script lang="ts">
import { AttachmentStyleBoxEditor } from '@hcengineering/attachment-resources'
import { updateBacklinks } from '@hcengineering/chunter-resources'
import { getClient } from '@hcengineering/presentation'
import { Component } from '@hcengineering/tracker'
import { EditBox } from '@hcengineering/ui'
@@ -52,8 +51,5 @@
key={{ key: 'description', attr: descriptionKey }}
bind:this={descriptionBox}
placeholder={tracker.string.IssueDescriptionPlaceholder}
updateBacklinks={(doc, description) => {
updateBacklinks(client, doc._id, doc._class, doc._id, description)
}}
/>
</div>
@@ -46,7 +46,6 @@
import CopyToClipboard from './CopyToClipboard.svelte'
import SubIssueSelector from './SubIssueSelector.svelte'
import SubIssues from './SubIssues.svelte'
import { updateBacklinks } from '@hcengineering/chunter-resources'
export let _id: Ref<Issue>
export let _class: Ref<Class<Issue>>
@@ -227,9 +226,6 @@
on:saved={(evt) => {
saved = evt.detail
}}
updateBacklinks={(doc, description) => {
updateBacklinks(client, doc._id, doc._class, doc._id, description)
}}
/>
</div>
@@ -19,7 +19,6 @@
import { createEventDispatcher, onMount } from 'svelte'
import tracker from '../../plugin'
import { AttachmentStyleBoxEditor } from '@hcengineering/attachment-resources'
import { updateBacklinks } from '@hcengineering/chunter-resources'
export let object: Milestone
@@ -65,8 +64,5 @@
key={{ key: 'description', attr: descriptionKey }}
bind:this={descriptionBox}
placeholder={tracker.string.IssueDescriptionPlaceholder}
updateBacklinks={(doc, description) => {
updateBacklinks(client, doc._id, doc._class, doc._id, description)
}}
/>
</div>
@@ -15,7 +15,6 @@
<script lang="ts">
import { Data, Ref } from '@hcengineering/core'
import { IntlString } from '@hcengineering/platform'
import { createBacklinks } from '@hcengineering/chunter'
import { Card, getClient, SpaceSelector } from '@hcengineering/presentation'
import { Milestone, MilestoneStatus, Project } from '@hcengineering/tracker'
import ui, { DatePresenter, EditBox } from '@hcengineering/ui'
@@ -39,9 +38,7 @@
}
async function onSave () {
const _id = await client.createDoc(tracker.class.Milestone, space, object)
// Create an backlink to document
await createBacklinks(client, _id, tracker.class.Milestone, _id, object.description ?? '')
await client.createDoc(tracker.class.Milestone, space, object)
}
</script>
@@ -37,7 +37,6 @@
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
import tracker from '../../plugin'
import { updateBacklinks } from '@hcengineering/chunter-resources'
import SubIssueTemplates from './IssueTemplateChilds.svelte'
import TemplateControlPanel from './TemplateControlPanel.svelte'
@@ -185,9 +184,6 @@
on:saved={(evt) => {
saved = evt.detail
}}
updateBacklinks={(doc, description) => {
updateBacklinks(client, doc._id, doc._class, doc._id, description)
}}
/>
</div>
<div class="mt-6">