diff --git a/src/actions/admin-ads.ts b/src/actions/admin-ads.ts index cfe0139b3f..e86399deeb 100644 --- a/src/actions/admin-ads.ts +++ b/src/actions/admin-ads.ts @@ -57,7 +57,7 @@ export async function updateAd(formData: FormData): Promise { id: Number(raw), error: result.error.messageKey, }); - revalidatePath("/admin/ads/" + raw); + revalidatePath(`/admin/ads/${raw}`); return; } redirect("/admin/ads"); diff --git a/src/actions/admin-articles.ts b/src/actions/admin-articles.ts index 4ae7a9073c..52dd87bb26 100644 --- a/src/actions/admin-articles.ts +++ b/src/actions/admin-articles.ts @@ -54,7 +54,7 @@ export async function updateArticle(formData: FormData): Promise { { action: "update", id, ...articleInput(formData) }, ); if (!result.ok) redirect("/admin/articles?error=Update failed"); - revalidatePath("/admin/articles/" + id); + revalidatePath(`/admin/articles/${id}`); redirect("/admin/articles"); } diff --git a/src/actions/admin-help.ts b/src/actions/admin-help.ts index e1bd849740..280652edcb 100644 --- a/src/actions/admin-help.ts +++ b/src/actions/admin-help.ts @@ -60,7 +60,7 @@ export async function updateHelpQuestion(formData: FormData): Promise { { action: "update", id, ...input }, ); if (!result.ok) { - revalidatePath("/admin/help-questions/" + id); + revalidatePath(`/admin/help-questions/${id}`); return; } redirect("/admin/help-questions"); diff --git a/src/actions/admin-theme.ts b/src/actions/admin-theme.ts index bcc5cbf826..a0a0f57838 100644 --- a/src/actions/admin-theme.ts +++ b/src/actions/admin-theme.ts @@ -49,7 +49,7 @@ export async function applyPreset(formData: FormData): Promise { if (result.ok) revalidatePath("/", "layout"); redirect( result.ok - ? "/admin/theme?preset=" + encodeURIComponent(name) + ? `/admin/theme?preset=${encodeURIComponent(name)}` : "/admin/theme", ); } @@ -80,7 +80,7 @@ export async function applyCustomTheme(formData: FormData): Promise { : ""; redirect( result.ok - ? "/admin/theme?theme=" + encodeURIComponent(name) + ? `/admin/theme?theme=${encodeURIComponent(name)}` : "/admin/theme", ); } diff --git a/src/features/housekeeping/domains/content/inbox-production.ts b/src/features/housekeeping/domains/content/inbox-production.ts index 51f5920038..24d8b4285b 100644 --- a/src/features/housekeeping/domains/content/inbox-production.ts +++ b/src/features/housekeeping/domains/content/inbox-production.ts @@ -62,7 +62,7 @@ export async function loadContentInboxItems( items.push({ sourceId, itemId: item.id, - deduplicationKey: sourceId + ":" + routeId + ":" + item.id, + deduplicationKey: `${sourceId}:${routeId}:${item.id}`, domain: "content", capability: anyCapability(permission), severity: diff --git a/src/features/housekeeping/domains/content/queries/content-queries-production.ts b/src/features/housekeeping/domains/content/queries/content-queries-production.ts index 7d58746904..14daa3afa2 100644 --- a/src/features/housekeeping/domains/content/queries/content-queries-production.ts +++ b/src/features/housekeeping/domains/content/queries/content-queries-production.ts @@ -283,7 +283,7 @@ async function mediaLibrary( .map(({ name, metadata }) => ({ id: name, title: name, - description: String(metadata.size) + " bytes", + description: `${String(metadata.size)} bytes`, status: "stored", updatedAt: metadata.mtime.toISOString(), href: "/ase/content/media/library", @@ -367,7 +367,7 @@ async function localizationFiles( { id: "cms", title: "CMS translations", - status: String(locales.length) + " locales", + status: `${String(locales.length)} locales`, href: "/ase/content/localization/cms", }, { diff --git a/src/features/housekeeping/domains/content/search-production.ts b/src/features/housekeeping/domains/content/search-production.ts index 5130e72201..c56e170d3d 100644 --- a/src/features/housekeeping/domains/content/search-production.ts +++ b/src/features/housekeeping/domains/content/search-production.ts @@ -41,7 +41,7 @@ export async function loadContentSearchCandidates( for (const item of result.data.items) { if (!item.href) continue; candidates.push({ - id: routeId + ":" + item.id, + id: `${routeId}:${item.id}`, title: item.title, description: item.description ?? item.status, href: item.href, diff --git a/src/features/housekeeping/domains/content/services/mutation-runtime-database.ts b/src/features/housekeeping/domains/content/services/mutation-runtime-database.ts index 4543102064..af4b423826 100644 --- a/src/features/housekeeping/domains/content/services/mutation-runtime-database.ts +++ b/src/features/housekeeping/domains/content/services/mutation-runtime-database.ts @@ -155,7 +155,7 @@ async function uniqueSlug( .where(eq(WebsiteArticles.slug, candidate)) .limit(1); if (!existing) return candidate; - candidate = base + "-" + suffix; + candidate = `${base}-${suffix}`; suffix += 1; } } @@ -261,7 +261,7 @@ async function adChange( await activity( context, "ad_create", - "Created advertisement #" + id + " (" + image + ")", + `Created advertisement #${id} (${image})`, "website_ad", Number(id), ); @@ -279,7 +279,7 @@ async function adChange( await activity( context, "ad_delete", - "Deleted advertisement #" + id, + `Deleted advertisement #${id}`, "website_ad", Number(id), ); @@ -297,7 +297,7 @@ async function adChange( await activity( context, "ad_update", - "Updated advertisement #" + id + " (" + image + ")", + `Updated advertisement #${id} (${image})`, "website_ad", Number(id), ); @@ -661,7 +661,7 @@ async function tagChange( await activity( context, "tag_create", - "Created tag " + name + " (#" + id + ")", + `Created tag ${name} (#${id})`, "tag", Number(id), ); @@ -678,7 +678,7 @@ async function tagChange( await activity( context, "tag_delete", - "Deleted tag #" + id, + `Deleted tag #${id}`, "tag", Number(id), ); @@ -696,7 +696,7 @@ async function tagChange( await activity( context, "tag_update", - "Updated tag #" + id + (values.name ? " to " + values.name : ""), + `Updated tag #${id}${values.name ? ` to ${values.name}` : ""}`, "tag", Number(id), ); @@ -838,7 +838,7 @@ async function helpQuestionChange( await activity( context, "help_delete", - "Deleted help-center entry #" + id, + `Deleted help-center entry #${id}`, "help_center_category", Number(id), ); @@ -864,7 +864,7 @@ async function helpQuestionChange( await activity( context, "help_create", - "Created help-center entry #" + id + " (" + createValues.name + ")", + `Created help-center entry #${id} (${createValues.name})`, "help_center_category", Number(id), ); @@ -906,7 +906,7 @@ async function helpQuestionChange( "help_update", "Updated help-center entry #" + id + - (values.name ? " (" + values.name + ")" : ""), + (values.name ? ` (${values.name})` : ""), "help_center_category", Number(id), ); @@ -933,7 +933,7 @@ async function writeableBoxChange( await activity( context, "writeable_box_delete", - "Deleted writeable box #" + id, + `Deleted writeable box #${id}`, "writeable_box", Number(id), ); @@ -949,7 +949,7 @@ async function writeableBoxChange( await activity( context, "writeable_box_toggle", - (isActive ? "Activated" : "Hid") + " writeable box #" + id, + `${isActive ? "Activated" : "Hid"} writeable box #${id}`, "writeable_box", Number(id), ); @@ -979,7 +979,7 @@ async function writeableBoxChange( await activity( context, "writeable_box_create", - "Created writeable box " + createValues.title + " (#" + id + ")", + `Created writeable box ${createValues.title} (#${id})`, "writeable_box", Number(id), ); @@ -1007,9 +1007,7 @@ async function writeableBoxChange( await activity( context, "writeable_box_update", - "Updated writeable box #" + - id + - (values.title ? " (" + values.title + ")" : ""), + "Updated writeable box #" + id + (values.title ? ` (${values.title})` : ""), "writeable_box", Number(id), ); diff --git a/src/features/housekeeping/domains/content/services/mutation-runtime-external.ts b/src/features/housekeeping/domains/content/services/mutation-runtime-external.ts index f2de73b29e..ad1d77d1f6 100644 --- a/src/features/housekeeping/domains/content/services/mutation-runtime-external.ts +++ b/src/features/housekeeping/domains/content/services/mutation-runtime-external.ts @@ -239,15 +239,14 @@ async function mediaUpload(input: unknown): Promise { MEDIA_TYPES, ); await mkdir(MEDIA_ROOT, { recursive: true }); - const name = - Date.now() + "-" + Math.random().toString(36).slice(2, 8) + "." + extension; + const name = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}.${extension}`; const filePath = resolveMediaPath(name); if (!filePath.startsWith(MEDIA_ROOT + path.sep)) throw validation(); await writeFile(filePath, bytes); return { before: null, after: { name, size: file.size, type }, - output: { name, url: "/api/media/" + name }, + output: { name, url: `/api/media/${name}` }, }; } @@ -291,7 +290,7 @@ async function photoDelete( await logStaffActivity({ staffId: context.capability.actor.id, action: "photo_delete", - description: "Deleted camera photo #" + id, + description: `Deleted camera photo #${id}`, targetType: "camera_web", targetId: id, }); @@ -459,7 +458,7 @@ async function themeApplyPreset( await logStaffActivity({ staffId: context.capability.actor.id, action: "theme_preset", - description: "Applied theme preset " + name, + description: `Applied theme preset ${name}`, }); } catch { throw new ContentCommittedExternalFailure(snapshot); @@ -504,7 +503,7 @@ async function themeCustomChange( await logStaffActivity({ staffId: context.capability.actor.id, action: "theme_preset", - description: "Saved custom theme " + theme.name, + description: `Saved custom theme ${theme.name}`, }); return { before: id ? { id } : null, @@ -547,7 +546,7 @@ async function themeApplyCustom( await logStaffActivity({ staffId: context.capability.actor.id, action: "theme_preset", - description: "Applied custom theme " + theme.name, + description: `Applied custom theme ${theme.name}`, }); } catch { throw new ContentCommittedExternalFailure(snapshot); @@ -580,13 +579,13 @@ async function faviconSave(input: unknown): Promise { FAVICON_TYPES, ); const directory = resolveMediaPath("favicon"); - const filename = "favicon-" + Date.now() + "." + extension; + const filename = `favicon-${Date.now()}.${extension}`; const filePath = path.resolve(directory, filename); if (!filePath.startsWith(directory + path.sep)) throw validation(); const oldUrl = await siteSettings.get("cms_favicon"); await mkdir(directory, { recursive: true }); await writeFile(filePath, bytes); - const url = "/api/media/favicon/" + filename; + const url = `/api/media/favicon/${filename}`; const snapshot: ContentMutationSnapshot = { before: { value: oldUrl ?? null }, after: { value: url }, @@ -654,7 +653,7 @@ async function logoSave(input: unknown): Promise { const oldUrl = await siteSettings.get("cms_logo"); await mkdir(directory, { recursive: true }); await writeFile(filePath, bytes); - const url = "/api/media/logo/" + filename; + const url = `/api/media/logo/${filename}`; const snapshot: ContentMutationSnapshot = { before: { value: oldUrl ?? null }, after: { value: url }, @@ -694,7 +693,7 @@ async function cmsTranslationSave( process.cwd(), "src", "messages", - locale + ".json", + `${locale}.json`, ); await writeFile(filePath, JSON.stringify(translations, null, 2), "utf-8"); return { diff --git a/src/features/housekeeping/domains/content/services/mutations-production.ts b/src/features/housekeeping/domains/content/services/mutations-production.ts index 72d26b6a21..175898aa1e 100644 --- a/src/features/housekeeping/domains/content/services/mutations-production.ts +++ b/src/features/housekeeping/domains/content/services/mutations-production.ts @@ -75,7 +75,7 @@ function auditEntry( ): AuditEntry { return { userId: context.capability.actor.id, - action: "content." + operation, + action: `content.${operation}`, target: "Content", correlationId: context.correlationId, domain: "content",