mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 03:14:40 +03:00
UBERF-7419: Fix various sentry errors (#5931)
This commit is contained in:
parent
777eb415aa
commit
80d22b556c
@ -38,6 +38,9 @@ function $push (document: Doc, keyval: Record<string, PropertyType>): void {
|
||||
arr.push(val)
|
||||
}
|
||||
} else {
|
||||
if (doc[key] == null) {
|
||||
doc[key] = []
|
||||
}
|
||||
doc[key].push(val)
|
||||
}
|
||||
}
|
||||
@ -53,7 +56,7 @@ function $pull (document: Doc, keyval: Record<string, PropertyType>): void {
|
||||
if (typeof keyval[key] === 'object' && keyval[key] !== null) {
|
||||
const { $in } = keyval[key] as PullArray<PropertyType>
|
||||
|
||||
doc[key] = arr.filter((val) => {
|
||||
doc[key] = (arr ?? []).filter((val) => {
|
||||
if ($in !== undefined) {
|
||||
return !$in.includes(val)
|
||||
} else {
|
||||
@ -67,7 +70,7 @@ function $pull (document: Doc, keyval: Record<string, PropertyType>): void {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
doc[key] = arr.filter((val) => val !== keyval[key])
|
||||
doc[key] = (arr ?? []).filter((val) => val !== keyval[key])
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,7 +122,7 @@ function $move (document: Doc, keyval: Record<string, PropertyType>): void {
|
||||
}
|
||||
const arr = doc[key] as Array<any>
|
||||
const desc = keyval[key]
|
||||
doc[key] = arr.filter((val) => val !== desc.$value)
|
||||
doc[key] = (arr ?? []).filter((val) => val !== desc.$value)
|
||||
doc[key].splice(desc.$position, 0, desc.$value)
|
||||
}
|
||||
}
|
||||
@ -134,7 +137,7 @@ function $pushMixin (document: Doc, options: any): void {
|
||||
const keyval = options.values
|
||||
for (const key in keyval) {
|
||||
const arr = mixin[key]
|
||||
if (arr === undefined) {
|
||||
if (arr == null) {
|
||||
mixin[key] = [keyval[key]]
|
||||
} else {
|
||||
arr.push(keyval[key])
|
||||
|
@ -71,7 +71,10 @@
|
||||
created.length > 0 ||
|
||||
objects.map((it) => getObjectValue(groupBy, it)).filter((it, index, arr) => arr.indexOf(it) === index).length > 1
|
||||
|
||||
const checkSelected = (item: Doc): void => {
|
||||
const checkSelected = (item?: Doc): void => {
|
||||
if (item === undefined) {
|
||||
return
|
||||
}
|
||||
if (selectedElements.has(item._id)) {
|
||||
selectedElements.delete(item._id)
|
||||
} else {
|
||||
|
@ -304,7 +304,9 @@ export function getPlatformColors (darkTheme: boolean): readonly ColorDefinition
|
||||
}
|
||||
|
||||
function hashCode (str: string): number {
|
||||
return str.split('').reduce((prevHash, currVal) => ((prevHash << 5) - prevHash + currVal.charCodeAt(0)) | 0, 0)
|
||||
return (str ?? '')
|
||||
.split('')
|
||||
.reduce((prevHash, currVal) => ((prevHash << 5) - prevHash + currVal.charCodeAt(0)) | 0, 0)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,9 @@
|
||||
|
||||
async function handleSelection (evt: Event | undefined, selection: number): Promise<void> {
|
||||
const item = objects[selection]
|
||||
if (item == null) {
|
||||
return
|
||||
}
|
||||
if (multiselect && Array.isArray(selected)) {
|
||||
const index = selected.indexOf(item.id)
|
||||
if (index !== -1) {
|
||||
|
@ -208,10 +208,10 @@
|
||||
|
||||
const checkSizes = (): void => {
|
||||
if (sState === SeparatorState.FLOAT) {
|
||||
if (parentElement) initSize(parentElement, panel)
|
||||
if (parentElement != null && panel != null) initSize(parentElement, panel)
|
||||
} else if (sState === SeparatorState.NORMAL) {
|
||||
if (prevElement) initSize(prevElement, prevElSize)
|
||||
if (nextElement) initSize(nextElement, nextElSize, true)
|
||||
if (prevElement != null && prevElSize != null) initSize(prevElement, prevElSize)
|
||||
if (nextElement != null && nextElSize != null) initSize(nextElement, nextElSize, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,7 @@
|
||||
name="file"
|
||||
id="file"
|
||||
style="display: none"
|
||||
disabled={inputFile == null}
|
||||
on:change={fileSelected}
|
||||
/>
|
||||
</div>
|
||||
|
@ -107,6 +107,7 @@
|
||||
name="file"
|
||||
id="file"
|
||||
style="display: none"
|
||||
disabled={inputFile == null}
|
||||
on:change={fileSelected}
|
||||
/>
|
||||
<div class="flex flex-between flex-grow header clear-mins">
|
||||
|
@ -308,6 +308,7 @@
|
||||
<div class="no-print" bind:this={refContainer}>
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -243,6 +243,7 @@
|
||||
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -65,9 +65,7 @@
|
||||
loading--
|
||||
}
|
||||
|
||||
if (inputFile) {
|
||||
inputFile.value = ''
|
||||
}
|
||||
inputFile.value = ''
|
||||
|
||||
dispatch('attached')
|
||||
}
|
||||
@ -103,6 +101,7 @@
|
||||
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -126,6 +126,7 @@
|
||||
{/if}
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -159,26 +159,30 @@ function createModelPersistence (workspace: string): TxPersistenceStore | undefi
|
||||
load: async () => {
|
||||
const db = await dbPromise
|
||||
if (db !== undefined) {
|
||||
const transaction = db.transaction('model', 'readwrite') // (1)
|
||||
const models = transaction.objectStore('model') // (2)
|
||||
const model = await new Promise<{ id: string, model: LoadModelResponse } | undefined>((resolve) => {
|
||||
const storedValue: IDBRequest<{ id: string, model: LoadModelResponse }> = models.get(workspace)
|
||||
storedValue.onsuccess = function () {
|
||||
resolve(storedValue.result)
|
||||
}
|
||||
storedValue.onerror = function () {
|
||||
resolve(undefined)
|
||||
}
|
||||
})
|
||||
try {
|
||||
const transaction = db.transaction('model', 'readwrite') // (1)
|
||||
const models = transaction.objectStore('model') // (2)
|
||||
const model = await new Promise<{ id: string, model: LoadModelResponse } | undefined>((resolve) => {
|
||||
const storedValue: IDBRequest<{ id: string, model: LoadModelResponse }> = models.get(workspace)
|
||||
storedValue.onsuccess = function () {
|
||||
resolve(storedValue.result)
|
||||
}
|
||||
storedValue.onerror = function () {
|
||||
resolve(undefined)
|
||||
}
|
||||
})
|
||||
|
||||
if (model == null) {
|
||||
return {
|
||||
full: false,
|
||||
transactions: [],
|
||||
hash: ''
|
||||
if (model == null) {
|
||||
return {
|
||||
full: false,
|
||||
transactions: [],
|
||||
hash: ''
|
||||
}
|
||||
}
|
||||
return model.model
|
||||
} catch (err: any) {
|
||||
// Assume no model is stored.
|
||||
}
|
||||
return model.model
|
||||
}
|
||||
return {
|
||||
full: true,
|
||||
|
@ -107,6 +107,7 @@
|
||||
{:else}
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -177,6 +177,7 @@
|
||||
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -261,6 +261,7 @@
|
||||
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -76,7 +76,7 @@
|
||||
.findAllSync<Application>(workbench.class.Application, { hidden: false, _id: { $nin: excludedApps } })
|
||||
|
||||
async function resolveShortLink (loc: Location): Promise<ResolvedLocation | undefined> {
|
||||
if (loc.path[2] !== undefined && loc.path[2].trim().length > 0) {
|
||||
if (loc.path[2] != null && loc.path[2].trim().length > 0) {
|
||||
const app = apps.find((p) => p.alias === loc.path[2])
|
||||
if (app?.locationResolver) {
|
||||
const resolver = await getResource(app.locationResolver)
|
||||
@ -181,7 +181,7 @@
|
||||
|
||||
if (fragment !== currentFragment) {
|
||||
currentFragment = fragment
|
||||
if (fragment !== undefined && fragment.trim().length > 0) {
|
||||
if (fragment != null && fragment.trim().length > 0) {
|
||||
await setOpenPanelFocus(fragment)
|
||||
} else {
|
||||
closePanel()
|
||||
|
@ -46,7 +46,7 @@
|
||||
? getEndDate(currentDate.getFullYear(), 11)
|
||||
: getEndDate(currentDate.getFullYear(), currentDate.getMonth())
|
||||
|
||||
$: departments = [department, ...getDescendants(department, descendants)]
|
||||
$: departments = [department, ...getDescendants(department, descendants, new Set())]
|
||||
$: staffIdsForOpenedDepartments = staff.filter((p) => departments.includes(p.department)).map((p) => p._id)
|
||||
|
||||
const lq = createQuery()
|
||||
@ -79,11 +79,16 @@
|
||||
|
||||
function getDescendants (
|
||||
department: Ref<Department>,
|
||||
descendants: Map<Ref<Department>, Department[]>
|
||||
descendants: Map<Ref<Department>, Department[]>,
|
||||
visited: Set<string>
|
||||
): Ref<Department>[] {
|
||||
const res = (descendants.get(department) ?? []).map((p) => p._id)
|
||||
for (const department of res) {
|
||||
res.push(...getDescendants(department, descendants))
|
||||
const has = visited.has(department)
|
||||
if (!has) {
|
||||
visited.add(department)
|
||||
res.push(...getDescendants(department, descendants, visited))
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
@ -135,7 +135,7 @@
|
||||
await tick()
|
||||
index = participants.findIndex((p) => p._id === participant.identity)
|
||||
const el = participantElements[index]
|
||||
if (el !== undefined) {
|
||||
if (el != null) {
|
||||
el.appendChild(element)
|
||||
return
|
||||
}
|
||||
@ -180,7 +180,7 @@
|
||||
return
|
||||
}
|
||||
const index = participants.findIndex((p) => p._id === participant.identity)
|
||||
if (index !== -1) {
|
||||
if (index !== -1 && participantElements[index] != null) {
|
||||
participantElements[index].setTrackMuted(publication.isMuted)
|
||||
}
|
||||
} else {
|
||||
|
@ -168,7 +168,7 @@
|
||||
return
|
||||
}
|
||||
const index = participants.findIndex((p) => p._id === participant.identity)
|
||||
if (index !== -1) {
|
||||
if (index !== -1 && participantElements[index] != null) {
|
||||
participantElements[index].setTrackMuted(publication.isMuted)
|
||||
}
|
||||
} else {
|
||||
|
@ -613,6 +613,7 @@ export async function tryConnect (
|
||||
})
|
||||
requestsQuery.query(love.class.JoinRequest, { person: (me as PersonAccount).person, _id }, (res) => {
|
||||
const req = res[0]
|
||||
if (req === undefined) return
|
||||
if (req.status === RequestStatus.Pending) return
|
||||
requestsQuery.unsubscribe()
|
||||
if (req.status === RequestStatus.Approved) {
|
||||
|
@ -222,6 +222,7 @@
|
||||
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -184,6 +184,7 @@
|
||||
</div>
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -216,9 +216,12 @@
|
||||
|
||||
let currentProject: Project | undefined
|
||||
|
||||
let descriptionBox: AttachmentStyledBox | undefined
|
||||
|
||||
$: updateIssueStatusId(object, currentProject)
|
||||
$: updateAssigneeId(object, currentProject)
|
||||
$: canSave =
|
||||
descriptionBox != null &&
|
||||
getTitle(object.title ?? '').length > 0 &&
|
||||
object.status !== undefined &&
|
||||
kind !== undefined &&
|
||||
@ -343,8 +346,6 @@
|
||||
const dispatch = createEventDispatcher()
|
||||
const spaceQuery = createQuery()
|
||||
|
||||
let descriptionBox: AttachmentStyledBox
|
||||
|
||||
const key: KeyedAttribute = {
|
||||
key: 'labels',
|
||||
attr: client.getHierarchy().getAttribute(tracker.class.Issue, 'labels')
|
||||
@ -513,7 +514,7 @@
|
||||
}
|
||||
|
||||
await operations.commit()
|
||||
await descriptionBox.createAttachments(_id)
|
||||
await descriptionBox?.createAttachments(_id)
|
||||
|
||||
const parents: IssueParentInfo[] =
|
||||
parentIssue != null
|
||||
@ -986,7 +987,7 @@
|
||||
showPreview
|
||||
removable
|
||||
on:remove={(result) => {
|
||||
if (result.detail !== undefined) descriptionBox.removeAttachmentById(result.detail._id)
|
||||
if (result.detail !== undefined) descriptionBox?.removeAttachmentById(result.detail._id)
|
||||
}}
|
||||
/>
|
||||
{/each}
|
||||
@ -1000,7 +1001,7 @@
|
||||
size={'large'}
|
||||
kind={'ghost'}
|
||||
on:click={() => {
|
||||
descriptionBox.handleAttach()
|
||||
descriptionBox?.handleAttach()
|
||||
}}
|
||||
/>
|
||||
<DocCreateExtComponent manager={docCreateManager} kind={'footer'} space={currentProject} props={extraProps} />
|
||||
|
@ -100,6 +100,7 @@
|
||||
<div class="antiNav-subheader">
|
||||
<input
|
||||
bind:this={inputFile}
|
||||
disabled={inputFile == null}
|
||||
multiple
|
||||
type="file"
|
||||
name="file"
|
||||
|
@ -223,7 +223,7 @@
|
||||
|
||||
async function resolveShortLink (loc: Location): Promise<ResolvedLocation | undefined> {
|
||||
let locationResolver = currentApplication?.locationResolver
|
||||
if (loc.path[2] !== undefined && loc.path[2].trim().length > 0) {
|
||||
if (loc.path[2] != null && loc.path[2].trim().length > 0) {
|
||||
const app = apps.find((p) => p.alias === loc.path[2])
|
||||
if (app?.locationResolver) {
|
||||
locationResolver = app?.locationResolver
|
||||
@ -391,7 +391,7 @@
|
||||
currentQuery = loc.query
|
||||
if (fragment !== currentFragment) {
|
||||
currentFragment = fragment
|
||||
if (fragment !== undefined && fragment.trim().length > 0) {
|
||||
if (fragment != null && fragment.trim().length > 0) {
|
||||
await setOpenPanelFocus(fragment)
|
||||
} else {
|
||||
closePanel()
|
||||
|
Loading…
Reference in New Issue
Block a user