mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Empty title subissue, backreferences fix (#2280)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
6e4474494d
commit
9290942a56
@ -24,7 +24,7 @@ import chunter, {
|
|||||||
Backlink
|
Backlink
|
||||||
} from '@hcengineering/chunter'
|
} from '@hcengineering/chunter'
|
||||||
import { NotificationClientImpl } from '@hcengineering/notification-resources'
|
import { NotificationClientImpl } from '@hcengineering/notification-resources'
|
||||||
import { Resources } from '@hcengineering/platform'
|
import { IntlString, Resources, translate } from '@hcengineering/platform'
|
||||||
import preference from '@hcengineering/preference'
|
import preference from '@hcengineering/preference'
|
||||||
import { getClient, MessageBox } from '@hcengineering/presentation'
|
import { getClient, MessageBox } from '@hcengineering/presentation'
|
||||||
import { getCurrentLocation, navigate, showPopup } from '@hcengineering/ui'
|
import { getCurrentLocation, navigate, showPopup } from '@hcengineering/ui'
|
||||||
@ -190,13 +190,14 @@ export function chunterBrowserVisible (spaces: Space[]): boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
async function update (source: Doc, key: string, target: RelatedDocument[], msg: string): Promise<void> {
|
async function update (source: Doc, key: string, target: RelatedDocument[], msg: IntlString): Promise<void> {
|
||||||
|
const message = await translate(msg, {})
|
||||||
const backlinks: Array<Data<Backlink>> = target.map((it) => ({
|
const backlinks: Array<Data<Backlink>> = target.map((it) => ({
|
||||||
backlinkId: source._id,
|
backlinkId: source._id,
|
||||||
backlinkClass: source._class,
|
backlinkClass: source._class,
|
||||||
attachedTo: it._id,
|
attachedTo: it._id,
|
||||||
attachedToClass: it._class,
|
attachedToClass: it._class,
|
||||||
message: msg,
|
message,
|
||||||
collection: key
|
collection: key
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -161,6 +161,6 @@ export default plugin(chunterId, {
|
|||||||
},
|
},
|
||||||
backreference: {
|
backreference: {
|
||||||
// Update list of back references
|
// Update list of back references
|
||||||
Update: '' as Resource<(source: Doc, key: string, target: RelatedDocument[], label: IntlString) => void>
|
Update: '' as Resource<(source: Doc, key: string, target: RelatedDocument[], label: IntlString) => Promise<void>>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import chunter from '@hcengineering/chunter'
|
import chunter from '@hcengineering/chunter'
|
||||||
import { Employee } from '@hcengineering/contact'
|
import { Employee } from '@hcengineering/contact'
|
||||||
import core, { Account, AttachedData, Doc, generateId, Ref, SortingOrder, WithLookup } from '@hcengineering/core'
|
import core, { Account, AttachedData, Doc, generateId, Ref, SortingOrder, WithLookup } from '@hcengineering/core'
|
||||||
import { getResource, translate } from '@hcengineering/platform'
|
import { getResource } from '@hcengineering/platform'
|
||||||
import { Card, createQuery, getClient, KeyedAttribute, SpaceSelector } from '@hcengineering/presentation'
|
import { Card, createQuery, getClient, KeyedAttribute, SpaceSelector } from '@hcengineering/presentation'
|
||||||
import tags, { TagElement, TagReference } from '@hcengineering/tags'
|
import tags, { TagElement, TagReference } from '@hcengineering/tags'
|
||||||
import { calcRank, Issue, IssuePriority, IssueStatus, Project, Sprint, Team } from '@hcengineering/tracker'
|
import { calcRank, Issue, IssuePriority, IssueStatus, Project, Sprint, Team } from '@hcengineering/tracker'
|
||||||
@ -190,7 +190,9 @@
|
|||||||
const update = await getResource(chunter.backreference.Update)
|
const update = await getResource(chunter.backreference.Update)
|
||||||
if (relatedTo !== undefined) {
|
if (relatedTo !== undefined) {
|
||||||
const doc = await client.findOne(tracker.class.Issue, { _id: objectId })
|
const doc = await client.findOne(tracker.class.Issue, { _id: objectId })
|
||||||
await update(doc, 'relations', [relatedTo], await translate(tracker.string.AddedReference, {}))
|
if (doc !== undefined) {
|
||||||
|
await update(doc, 'relations', [relatedTo], tracker.string.AddedReference)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
objectId = generateId()
|
objectId = generateId()
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher, afterUpdate } from 'svelte'
|
import chunter from '@hcengineering/chunter'
|
||||||
import { Class, Doc, Ref, RelatedDocument } from '@hcengineering/core'
|
import { Class, Doc, Ref, RelatedDocument } from '@hcengineering/core'
|
||||||
import { getResource, IntlString, translate } from '@hcengineering/platform'
|
import { getResource, IntlString } from '@hcengineering/platform'
|
||||||
import { createQuery, getClient, ObjectSearchPopup, ObjectSearchResult } from '@hcengineering/presentation'
|
import { createQuery, getClient, ObjectSearchPopup, ObjectSearchResult } from '@hcengineering/presentation'
|
||||||
import { Issue } from '@hcengineering/tracker'
|
import { Issue } from '@hcengineering/tracker'
|
||||||
import { Action, closePopup, Menu, showPopup } from '@hcengineering/ui'
|
import { Action, closePopup, Menu, showPopup } from '@hcengineering/ui'
|
||||||
|
import { afterUpdate, createEventDispatcher } from 'svelte'
|
||||||
import { updateIssueRelation } from '../issues'
|
import { updateIssueRelation } from '../issues'
|
||||||
import tracker from '../plugin'
|
import tracker from '../plugin'
|
||||||
import chunter from '@hcengineering/chunter'
|
|
||||||
|
|
||||||
export let value: Issue
|
export let value: Issue
|
||||||
|
|
||||||
@ -65,7 +65,7 @@
|
|||||||
if (operation === '$pull' && pos !== -1) {
|
if (operation === '$pull' && pos !== -1) {
|
||||||
docs.splice(pos, 1)
|
docs.splice(pos, 1)
|
||||||
}
|
}
|
||||||
await update(value, type, docs, await translate(label, {}))
|
await update(value, type, docs, label)
|
||||||
}
|
}
|
||||||
|
|
||||||
const makeAddAction = (type: keyof typeof relations, placeholder: IntlString) => async (props: any, evt: Event) => {
|
const makeAddAction = (type: keyof typeof relations, placeholder: IntlString) => async (props: any, evt: Event) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import chunter from '@hcengineering/chunter'
|
import chunter from '@hcengineering/chunter'
|
||||||
import { Class, Doc, Ref, RelatedDocument, WithLookup } from '@hcengineering/core'
|
import { Class, Doc, Ref, RelatedDocument, WithLookup } from '@hcengineering/core'
|
||||||
import { getResource, IntlString, translate } from '@hcengineering/platform'
|
import { getResource, IntlString } from '@hcengineering/platform'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||||
import { Issue } from '@hcengineering/tracker'
|
import { Issue } from '@hcengineering/tracker'
|
||||||
import { Component, Icon, IconClose } from '@hcengineering/ui'
|
import { Component, Icon, IconClose } from '@hcengineering/ui'
|
||||||
@ -68,7 +68,7 @@
|
|||||||
if (pos !== -1) {
|
if (pos !== -1) {
|
||||||
docs.splice(pos, 1)
|
docs.splice(pos, 1)
|
||||||
}
|
}
|
||||||
await update(value, type, docs, await translate(label, {}))
|
await update(value, type, docs, label)
|
||||||
}
|
}
|
||||||
const asIssue = (x: Doc) => x as WithLookup<Issue>
|
const asIssue = (x: Doc) => x as WithLookup<Issue>
|
||||||
</script>
|
</script>
|
||||||
|
@ -82,7 +82,8 @@
|
|||||||
if (!canSave) {
|
if (!canSave) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
loading = true
|
||||||
|
try {
|
||||||
const space = currentTeam._id
|
const space = currentTeam._id
|
||||||
const lastOne = await client.findOne<Issue>(
|
const lastOne = await client.findOne<Issue>(
|
||||||
tracker.class.Issue,
|
tracker.class.Issue,
|
||||||
@ -121,7 +122,10 @@
|
|||||||
tag: label.tag
|
tag: label.tag
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
resetToDefaults()
|
resetToDefaults()
|
||||||
|
loading = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTagRef (tag: TagElement): void {
|
function addTagRef (tag: TagElement): void {
|
||||||
@ -143,6 +147,8 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let loading = false
|
||||||
|
|
||||||
$: thisRef && thisRef.scrollIntoView({ behavior: 'smooth' })
|
$: thisRef && thisRef.scrollIntoView({ behavior: 'smooth' })
|
||||||
$: canSave = getTitle(newIssue.title ?? '').length > 0
|
$: canSave = getTitle(newIssue.title ?? '').length > 0
|
||||||
$: if (!newIssue.status && currentTeam?.defaultIssueStatus) {
|
$: if (!newIssue.status && currentTeam?.defaultIssueStatus) {
|
||||||
@ -222,6 +228,7 @@
|
|||||||
<div class="buttons-group small-gap">
|
<div class="buttons-group small-gap">
|
||||||
<Button label={presentation.string.Cancel} size="small" kind="transparent" on:click={close} />
|
<Button label={presentation.string.Cancel} size="small" kind="transparent" on:click={close} />
|
||||||
<Button
|
<Button
|
||||||
|
{loading}
|
||||||
disabled={!canSave}
|
disabled={!canSave}
|
||||||
label={presentation.string.Save}
|
label={presentation.string.Save}
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -89,7 +89,9 @@
|
|||||||
if (!canSave) {
|
if (!canSave) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
loading = true
|
||||||
|
|
||||||
|
try {
|
||||||
const lastOne = await client.findOne<Issue>(
|
const lastOne = await client.findOne<Issue>(
|
||||||
tracker.class.Issue,
|
tracker.class.Issue,
|
||||||
{ space: currentTeam },
|
{ space: currentTeam },
|
||||||
@ -126,7 +128,10 @@
|
|||||||
tag: label.tag
|
tag: label.tag
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
resetToDefaults()
|
resetToDefaults()
|
||||||
|
loading = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTagRef (tag: TagElement): void {
|
function addTagRef (tag: TagElement): void {
|
||||||
@ -148,6 +153,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let loading = false
|
||||||
$: thisRef && thisRef.scrollIntoView({ behavior: 'smooth' })
|
$: thisRef && thisRef.scrollIntoView({ behavior: 'smooth' })
|
||||||
$: canSave = getTitle(newIssue.title ?? '').length > 0
|
$: canSave = getTitle(newIssue.title ?? '').length > 0
|
||||||
$: if (!newIssue.status) {
|
$: if (!newIssue.status) {
|
||||||
@ -230,6 +236,7 @@
|
|||||||
<div class="buttons-group small-gap">
|
<div class="buttons-group small-gap">
|
||||||
<Button label={presentation.string.Cancel} size="small" kind="transparent" on:click={close} />
|
<Button label={presentation.string.Cancel} size="small" kind="transparent" on:click={close} />
|
||||||
<Button
|
<Button
|
||||||
|
{loading}
|
||||||
disabled={!canSave}
|
disabled={!canSave}
|
||||||
label={presentation.string.Save}
|
label={presentation.string.Save}
|
||||||
size="small"
|
size="small"
|
||||||
|
Loading…
Reference in New Issue
Block a user