From 417a6ac084bac555b5b5bfe3eed4acb32da055e8 Mon Sep 17 00:00:00 2001 From: Chunosov Date: Tue, 10 Dec 2024 17:47:53 +0700 Subject: [PATCH] remove spaces from vacancy name (#7417) Signed-off-by: Nikolay Chunosov --- .../recruit-resources/src/components/CreateVacancy.svelte | 8 ++++---- .../recruit-resources/src/components/EditVacancy.svelte | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/recruit-resources/src/components/CreateVacancy.svelte b/plugins/recruit-resources/src/components/CreateVacancy.svelte index 40a08eade5..a3c546c8c3 100644 --- a/plugins/recruit-resources/src/components/CreateVacancy.svelte +++ b/plugins/recruit-resources/src/components/CreateVacancy.svelte @@ -103,7 +103,7 @@ type: typeId as Ref } export function canClose (): boolean { - return name === '' && typeId !== undefined + return name.trim() === '' && typeId !== undefined } const client = getClient() @@ -185,7 +185,7 @@ const resId: Ref = generateId() const identifier = `${project?.identifier}-${number}` const data: AttachedData = { - 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 = { ...vacancyData, - name, + name: name.trim(), description: template?.shortDescription ?? '', fullDescription: null, private: false, @@ -336,7 +336,7 @@ { dispatch('close') diff --git a/plugins/recruit-resources/src/components/EditVacancy.svelte b/plugins/recruit-resources/src/components/EditVacancy.svelte index 8ccc9d8907..b43f63d082 100644 --- a/plugins/recruit-resources/src/components/EditVacancy.svelte +++ b/plugins/recruit-resources/src/components/EditVacancy.svelte @@ -101,9 +101,13 @@ const updates: Partial> = {} 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) {