UBERF-4725 Migrate collaborative content (#5717)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2024-08-22 16:03:42 +05:00
committed by GitHub
parent 0e72b85978
commit df2a9b2708
97 changed files with 702 additions and 820 deletions
@@ -27,6 +27,7 @@
SortingOrder,
fillDefaults,
generateId,
makeCollaborativeDoc,
toIdMap
} from '@hcengineering/core'
import { getResource, translate } from '@hcengineering/platform'
@@ -41,7 +42,9 @@
MultipleDraftController,
SpaceSelector,
createQuery,
getClient
getClient,
getMarkup,
updateMarkup
} from '@hcengineering/presentation'
import tags, { TagElement, TagReference } from '@hcengineering/tags'
import { TaskType, makeRank } from '@hcengineering/task'
@@ -190,7 +193,6 @@
if (originalIssue !== undefined && !ignoreOriginal) {
const res: IssueDraft = {
...base,
description: originalIssue.description,
status: originalIssue.status,
priority: originalIssue.priority,
component: originalIssue.component,
@@ -200,6 +202,9 @@
parentIssue: originalIssue.parents[0]?.parentId,
title: `${originalIssue.title} (copy)`
}
void getMarkup(originalIssue.description).then((res) => {
object.description = res.description
})
void client.findAll(tags.class.TagReference, { attachedTo: originalIssue._id }).then((p) => {
object.labels = p
})
@@ -471,7 +476,7 @@
const value: DocData<Issue> = {
title: getTitle(object.title),
description: object.description,
description: makeCollaborativeDoc(_id, 'description'),
assignee: object.assignee,
component: object.component,
milestone: object.milestone,
@@ -504,6 +509,8 @@
identifier
}
await updateMarkup(value.description, { description: object.description })
await docCreateManager.commit(operations, _id, currentProject, value, 'pre')
await operations.addCollection(
@@ -14,8 +14,8 @@
-->
<script lang="ts">
import attachment, { Attachment } from '@hcengineering/attachment'
import core, { AttachedData, Doc, Ref, SortingOrder } from '@hcengineering/core'
import { DraftController, draftsStore, getClient, deleteFile } from '@hcengineering/presentation'
import core, { AttachedData, Doc, Ref, SortingOrder, makeCollaborativeDoc } from '@hcengineering/core'
import { DraftController, draftsStore, getClient, deleteFile, updateMarkup } from '@hcengineering/presentation'
import tags from '@hcengineering/tags'
import { makeRank } from '@hcengineering/task'
import { Component, Issue, IssueDraft, IssueParentInfo, Milestone, Project } from '@hcengineering/tracker'
@@ -71,7 +71,7 @@
const childId = subIssue._id
const cvalue: AttachedData<Issue> = {
title: subIssue.title.trim(),
description: subIssue.description,
description: makeCollaborativeDoc(childId, 'description'),
assignee: subIssue.assignee,
component: subIssue.component,
milestone: subIssue.milestone,
@@ -92,6 +92,7 @@
kind: subIssue.kind,
identifier: `${project.identifier}-${number}`
}
await updateMarkup(cvalue.description, { description: subIssue.description })
await client.addCollection(
tracker.class.Issue,
project._id,
@@ -15,11 +15,13 @@
<script lang="ts">
import attachment from '@hcengineering/attachment'
import { AttachmentDocList } from '@hcengineering/attachment-resources'
import { ChatMessagePopup } from '@hcengineering/chunter-resources'
import { Ref } from '@hcengineering/core'
import { IconForward, MessageViewer, createQuery, getClient } from '@hcengineering/presentation'
import { IconForward, createQuery, getClient } from '@hcengineering/presentation'
import { CollaborativeTextEditor } from '@hcengineering/text-editor-resources'
import { Issue } from '@hcengineering/tracker'
import { Label, Scroller, resizeObserver } from '@hcengineering/ui'
import { ChatMessagePopup } from '@hcengineering/chunter-resources'
import { getCollaborationUser } from '@hcengineering/view-resources'
import tracker from '../../plugin'
import AssigneeEditor from './AssigneeEditor.svelte'
@@ -34,6 +36,8 @@
const client = getClient()
const issueQuery = createQuery()
const user = getCollaborationUser()
$: issueQuery.query(
object._class,
{ _id: object._id },
@@ -91,7 +95,9 @@
{#if issue.description}
<div class="description-container" class:masked={cHeight > limit} style:max-height={`${limit}px`}>
<div class="description-content" use:resizeObserver={(element) => (cHeight = element.clientHeight)}>
<MessageViewer message={issue.description} />
{#key issue._id}
<CollaborativeTextEditor collaborativeDoc={issue.description} field="description" {user} readonly />
{/key}
</div>
</div>
{:else}
@@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { AttachmentStyleBoxCollabEditor } from '@hcengineering/attachment-resources'
import { AttachmentStyleBoxEditor } from '@hcengineering/attachment-resources'
import { Class, Doc, Ref, WithLookup } from '@hcengineering/core'
import notification from '@hcengineering/notification'
import { Panel } from '@hcengineering/panel'
@@ -45,7 +45,7 @@
let title = ''
let innerWidth: number
let descriptionBox: AttachmentStyleBoxCollabEditor
let descriptionBox: AttachmentStyleBoxEditor
const inboxClient = getResource(notification.function.GetInboxNotificationsClient).then((res) => res())
@@ -147,7 +147,7 @@
>
<EditBox bind:value={title} placeholder={tracker.string.IssueTitlePlaceholder} kind="large-style" on:blur={save} />
<div class="w-full mt-6">
<AttachmentStyleBoxCollabEditor
<AttachmentStyleBoxEditor
focusIndex={30}
object={template}
key={{ key: 'description', attr: descriptionKey }}