mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-25 19:58:30 +03:00
UBERF-5636 (#4762)
This commit is contained in:
parent
3e782658c6
commit
88b91d7ce0
@ -56,14 +56,22 @@
|
||||
let _id = currentMessage._id
|
||||
let inputContent = currentMessage.message
|
||||
|
||||
$: createdMessageQuery.query(_class, { _id }, (result: ChatMessage[]) => {
|
||||
if (result.length > 0 && _id !== chatMessage?._id) {
|
||||
// Ouch we have got comment with same id created already.
|
||||
currentMessage = getDefault()
|
||||
_id = currentMessage._id
|
||||
inputRef.removeDraft(false)
|
||||
}
|
||||
})
|
||||
$: if (currentDraft != null) {
|
||||
createdMessageQuery.query(_class, { _id }, (result: ChatMessage[]) => {
|
||||
if (result.length > 0 && _id !== chatMessage?._id) {
|
||||
// Ouch we have got comment with same id created already.
|
||||
clear()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
createdMessageQuery.unsubscribe()
|
||||
}
|
||||
|
||||
function clear (): void {
|
||||
currentMessage = getDefault()
|
||||
_id = currentMessage._id
|
||||
inputRef.removeDraft(false)
|
||||
}
|
||||
|
||||
function objectChange (draft: MessageDraft, empty: Partial<MessageDraft>) {
|
||||
if (shouldSaveDraft) {
|
||||
@ -131,11 +139,11 @@
|
||||
objectClass: parentMessage.attachedToClass,
|
||||
objectId: parentMessage.attachedTo
|
||||
},
|
||||
_id as Ref<ThreadMessage>,
|
||||
Date.now(),
|
||||
account._id
|
||||
_id as Ref<ThreadMessage>
|
||||
)
|
||||
|
||||
clear()
|
||||
|
||||
await client.update(parentMessage, { lastReply: Date.now() })
|
||||
|
||||
const hasPerson = !!parentMessage.repliedPersons?.includes(account.person)
|
||||
@ -151,10 +159,9 @@
|
||||
object._class,
|
||||
collection,
|
||||
{ message, attachments },
|
||||
_id,
|
||||
Date.now(),
|
||||
account._id
|
||||
_id
|
||||
)
|
||||
clear()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,6 @@
|
||||
const hierarchy = client.getHierarchy()
|
||||
|
||||
let issue: WithLookup<Issue> | undefined
|
||||
let currentProject: Project | undefined
|
||||
let title = ''
|
||||
let innerWidth: number
|
||||
let descriptionBox: AttachmentStyleBoxCollabEditor
|
||||
@ -99,14 +98,15 @@
|
||||
;[issue] = result
|
||||
if (issue !== undefined) {
|
||||
title = issue.title
|
||||
currentProject = issue.$lookup?.space
|
||||
}
|
||||
},
|
||||
{ lookup: { attachedTo: tracker.class.Issue, space: tracker.class.Project } }
|
||||
{
|
||||
limit: 1
|
||||
}
|
||||
)
|
||||
|
||||
$: canSave = title.trim().length > 0
|
||||
$: parentIssue = issue?.$lookup?.attachedTo
|
||||
$: hasParentIssue = issue?.attachedTo !== tracker.ids.NoParent
|
||||
|
||||
let saved = false
|
||||
async function save (): Promise<void> {
|
||||
@ -191,7 +191,7 @@
|
||||
on:select
|
||||
>
|
||||
<svelte:fragment slot="title">
|
||||
{#if !embedded}
|
||||
{#if !embedded && issue.attachedTo !== tracker.ids.NoParent}
|
||||
<ParentsNavigator element={issue} />
|
||||
{/if}
|
||||
{#if embedded}
|
||||
@ -205,10 +205,7 @@
|
||||
{#if (projectType?.tasks.length ?? 0) > 1 && taskType !== undefined}
|
||||
({taskType.name})
|
||||
{/if}
|
||||
<ComponentExtensions
|
||||
extension={tracker.extensions.EditIssueTitle}
|
||||
props={{ size: 'medium', value: issue, space: currentProject }}
|
||||
/>
|
||||
<ComponentExtensions extension={tracker.extensions.EditIssueTitle} props={{ size: 'medium', value: issue }} />
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="pre-utils">
|
||||
<ComponentExtensions
|
||||
@ -253,13 +250,9 @@
|
||||
/>
|
||||
</svelte:fragment>
|
||||
|
||||
{#if parentIssue}
|
||||
{#if hasParentIssue}
|
||||
<div class="mb-6">
|
||||
{#if currentProject}
|
||||
<SubIssueSelector {issue} />
|
||||
{:else}
|
||||
<Spinner />
|
||||
{/if}
|
||||
<SubIssueSelector {issue} />
|
||||
</div>
|
||||
{/if}
|
||||
<EditBox
|
||||
@ -285,10 +278,8 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="mt-6">
|
||||
{#key issue._id !== undefined && currentProject !== undefined}
|
||||
{#if currentProject !== undefined}
|
||||
<SubIssues focusIndex={50} {issue} shouldSaveDraft />
|
||||
{/if}
|
||||
{#key issue._id}
|
||||
<SubIssues focusIndex={50} {issue} shouldSaveDraft />
|
||||
{/key}
|
||||
</div>
|
||||
|
||||
@ -303,7 +294,7 @@
|
||||
</span>
|
||||
|
||||
<svelte:fragment slot="custom-attributes">
|
||||
{#if issue !== undefined && currentProject}
|
||||
{#if issue !== undefined}
|
||||
<div class="space-divider" />
|
||||
<ControlPanel {issue} {showAllMixins} {readonly} />
|
||||
{/if}
|
||||
|
@ -36,8 +36,11 @@
|
||||
import IssueStatusIcon from '../IssueStatusIcon.svelte'
|
||||
|
||||
export let issue: WithLookup<Issue>
|
||||
$: parentIssueId = issue.attachedTo !== tracker.ids.NoParent ? issue.attachedTo : undefined
|
||||
let parentIssue: Issue | undefined = undefined
|
||||
const parentQuery = createQuery()
|
||||
|
||||
const subIssuesQeury = createQuery()
|
||||
const subIssuesQuery = createQuery()
|
||||
|
||||
let subIssues: WithLookup<Issue>[] | undefined
|
||||
let subIssuesElement: Element
|
||||
@ -64,11 +67,10 @@
|
||||
}
|
||||
|
||||
$: areSubIssuesLoading = !subIssues
|
||||
$: parentIssue = issue.$lookup?.attachedTo ? issue.$lookup?.attachedTo : null
|
||||
$: if (parentIssue && parentIssue.subIssues > 0) {
|
||||
subIssuesQeury.query(
|
||||
$: if (parentIssueId) {
|
||||
subIssuesQuery.query(
|
||||
tracker.class.Issue,
|
||||
{ space: issue.space, attachedTo: parentIssue._id },
|
||||
{ attachedTo: parentIssueId },
|
||||
(res) => {
|
||||
subIssues = res
|
||||
},
|
||||
@ -79,8 +81,21 @@
|
||||
}
|
||||
}
|
||||
)
|
||||
parentQuery.query(
|
||||
tracker.class.Issue,
|
||||
{ _id: parentIssueId },
|
||||
(res) => {
|
||||
parentIssue = res[0]
|
||||
},
|
||||
{
|
||||
limit: 1
|
||||
}
|
||||
)
|
||||
} else {
|
||||
subIssuesQeury.unsubscribe()
|
||||
subIssuesQuery.unsubscribe()
|
||||
parentQuery.unsubscribe()
|
||||
parentIssue = undefined
|
||||
subIssues = []
|
||||
}
|
||||
|
||||
$: parentStatus = parentIssue ? $statusStore.byId.get(parentIssue.status) : undefined
|
||||
|
@ -25,11 +25,7 @@ export async function issueIdentifierProvider (client: TxOperations, ref: Ref<Is
|
||||
}
|
||||
|
||||
export async function issueTitleProvider (client: TxOperations, ref: Ref<Doc>): Promise<string> {
|
||||
const object = await client.findOne(
|
||||
tracker.class.Issue,
|
||||
{ _id: ref as Ref<Issue> },
|
||||
{ lookup: { space: tracker.class.Project } }
|
||||
)
|
||||
const object = await client.findOne(tracker.class.Issue, { _id: ref as Ref<Issue> })
|
||||
|
||||
if (object === undefined) {
|
||||
return ''
|
||||
|
Loading…
Reference in New Issue
Block a user