Fix create draft issue duplicate id (#2935)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2023-04-11 17:07:44 +07:00
committed by GitHub
parent 9c79f20aa4
commit 2b72b64df5
7 changed files with 49 additions and 45 deletions
@@ -100,6 +100,7 @@
if (!canSave) {
return
}
const _id: Ref<Issue> = generateId()
loading = true
try {
const space = currentProject._id
@@ -135,13 +136,13 @@
parentIssue._class,
'subIssues',
value,
object._id
_id
)
await descriptionBox.createAttachments()
await descriptionBox.createAttachments(_id)
for (const label of object.labels) {
await client.addCollection(label._class, label.space, object._id, tracker.class.Issue, 'labels', {
await client.addCollection(label._class, label.space, _id, tracker.class.Issue, 'labels', {
title: label.title,
color: label.color,
tag: label.tag
@@ -149,7 +150,7 @@
}
addNotification(await translate(tracker.string.IssueCreated, {}), getTitle(object.title), IssueNotification, {
issueId: object._id,
issueId: _id,
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
})
draftController.remove()
@@ -177,23 +177,25 @@
{/if}
<EditBox bind:value={title} placeholder={tracker.string.IssueTitlePlaceholder} kind="large-style" on:blur={save} />
<div class="w-full mt-6">
<AttachmentStyledBox
bind:this={descriptionBox}
useAttachmentPreview={true}
objectId={_id}
_class={tracker.class.Issue}
space={issue.space}
alwaysEdit
on:attached={save}
on:detached={save}
showButtons
on:blur={save}
on:changeContent={triggerSave}
maxHeight={'card'}
focusable
bind:content={description}
placeholder={tracker.string.IssueDescriptionPlaceholder}
/>
{#key _id}
<AttachmentStyledBox
bind:this={descriptionBox}
useAttachmentPreview={true}
objectId={_id}
_class={tracker.class.Issue}
space={issue.space}
alwaysEdit
on:attached={save}
on:detached={save}
showButtons
on:blur={save}
on:changeContent={triggerSave}
maxHeight={'card'}
focusable
bind:content={description}
placeholder={tracker.string.IssueDescriptionPlaceholder}
/>
{/key}
</div>
<div class="mt-6">