remove spaces from vacancy name (#7417)

Signed-off-by: Nikolay Chunosov <Chunosov.N@gmail.com>
This commit is contained in:
Chunosov 2024-12-10 17:47:53 +07:00 committed by GitHub
parent 9421887f01
commit 417a6ac084
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View File

@ -103,7 +103,7 @@
type: typeId as Ref<ProjectType>
}
export function canClose (): boolean {
return name === '' && typeId !== undefined
return name.trim() === '' && typeId !== undefined
}
const client = getClient()
@ -185,7 +185,7 @@
const resId: Ref<Issue> = generateId()
const identifier = `${project?.identifier}-${number}`
const data: AttachedData<Issue> = {
title: template.title + ` (${name})`,
title: template.title + ` (${name.trim()})`,
description: null,
assignee: template.assignee,
component: template.component,
@ -240,7 +240,7 @@
const incResult = await client.update(sequence, { $inc: { sequence: 1 } }, true)
const data: Data<Vacancy> = {
...vacancyData,
name,
name: name.trim(),
description: template?.shortDescription ?? '',
fullDescription: null,
private: false,
@ -336,7 +336,7 @@
<Card
label={recruit.string.CreateVacancy}
okAction={createVacancy}
canSave={!!name}
canSave={name.trim() !== ''}
gap={'gapV-4'}
on:close={() => {
dispatch('close')

View File

@ -101,9 +101,13 @@
const updates: Partial<Data<Vacancy>> = {}
const trimmedName = rawName.trim()
const trimmedNameOld = object.name?.trim()
if (trimmedName.length > 0 && trimmedName !== object.name?.trim()) {
if (trimmedName.length > 0 && (trimmedName !== trimmedNameOld || trimmedNameOld !== object.name)) {
updates.name = trimmedName
rawName = trimmedName
} else {
rawName = object.name
}
if (rawDesc !== object.description) {