style: satisfy cumulative biome checks
This commit is contained in:
1 parent
cb77b2d3b9
commit
b9c47aa89a
10 files changed
+34
-37
No files matched your search
@@ -57,7 +57,7 @@ export async function updateAd(formData: FormData): Promise<void> {
|
|||||||
id: Number(raw),
|
id: Number(raw),
|
||||||
error: result.error.messageKey,
|
error: result.error.messageKey,
|
||||||
});
|
});
|
||||||
revalidatePath("/admin/ads/" + raw);
|
revalidatePath(`/admin/ads/${raw}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
redirect("/admin/ads");
|
redirect("/admin/ads");
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export async function updateArticle(formData: FormData): Promise<void> {
|
|||||||
{ action: "update", id, ...articleInput(formData) },
|
{ action: "update", id, ...articleInput(formData) },
|
||||||
);
|
);
|
||||||
if (!result.ok) redirect("/admin/articles?error=Update failed");
|
if (!result.ok) redirect("/admin/articles?error=Update failed");
|
||||||
revalidatePath("/admin/articles/" + id);
|
revalidatePath(`/admin/articles/${id}`);
|
||||||
redirect("/admin/articles");
|
redirect("/admin/articles");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export async function updateHelpQuestion(formData: FormData): Promise<void> {
|
|||||||
{ action: "update", id, ...input },
|
{ action: "update", id, ...input },
|
||||||
);
|
);
|
||||||
if (!result.ok) {
|
if (!result.ok) {
|
||||||
revalidatePath("/admin/help-questions/" + id);
|
revalidatePath(`/admin/help-questions/${id}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
redirect("/admin/help-questions");
|
redirect("/admin/help-questions");
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export async function applyPreset(formData: FormData): Promise<void> {
|
|||||||
if (result.ok) revalidatePath("/", "layout");
|
if (result.ok) revalidatePath("/", "layout");
|
||||||
redirect(
|
redirect(
|
||||||
result.ok
|
result.ok
|
||||||
? "/admin/theme?preset=" + encodeURIComponent(name)
|
? `/admin/theme?preset=${encodeURIComponent(name)}`
|
||||||
: "/admin/theme",
|
: "/admin/theme",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ export async function applyCustomTheme(formData: FormData): Promise<void> {
|
|||||||
: "";
|
: "";
|
||||||
redirect(
|
redirect(
|
||||||
result.ok
|
result.ok
|
||||||
? "/admin/theme?theme=" + encodeURIComponent(name)
|
? `/admin/theme?theme=${encodeURIComponent(name)}`
|
||||||
: "/admin/theme",
|
: "/admin/theme",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export async function loadContentInboxItems(
|
|||||||
items.push({
|
items.push({
|
||||||
sourceId,
|
sourceId,
|
||||||
itemId: item.id,
|
itemId: item.id,
|
||||||
deduplicationKey: sourceId + ":" + routeId + ":" + item.id,
|
deduplicationKey: `${sourceId}:${routeId}:${item.id}`,
|
||||||
domain: "content",
|
domain: "content",
|
||||||
capability: anyCapability(permission),
|
capability: anyCapability(permission),
|
||||||
severity:
|
severity:
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ async function mediaLibrary(
|
|||||||
.map(({ name, metadata }) => ({
|
.map(({ name, metadata }) => ({
|
||||||
id: name,
|
id: name,
|
||||||
title: name,
|
title: name,
|
||||||
description: String(metadata.size) + " bytes",
|
description: `${String(metadata.size)} bytes`,
|
||||||
status: "stored",
|
status: "stored",
|
||||||
updatedAt: metadata.mtime.toISOString(),
|
updatedAt: metadata.mtime.toISOString(),
|
||||||
href: "/ase/content/media/library",
|
href: "/ase/content/media/library",
|
||||||
@@ -367,7 +367,7 @@ async function localizationFiles(
|
|||||||
{
|
{
|
||||||
id: "cms",
|
id: "cms",
|
||||||
title: "CMS translations",
|
title: "CMS translations",
|
||||||
status: String(locales.length) + " locales",
|
status: `${String(locales.length)} locales`,
|
||||||
href: "/ase/content/localization/cms",
|
href: "/ase/content/localization/cms",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export async function loadContentSearchCandidates(
|
|||||||
for (const item of result.data.items) {
|
for (const item of result.data.items) {
|
||||||
if (!item.href) continue;
|
if (!item.href) continue;
|
||||||
candidates.push({
|
candidates.push({
|
||||||
id: routeId + ":" + item.id,
|
id: `${routeId}:${item.id}`,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
description: item.description ?? item.status,
|
description: item.description ?? item.status,
|
||||||
href: item.href,
|
href: item.href,
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -239,15 +239,14 @@ async function mediaUpload(input: unknown): Promise<ContentMutationSnapshot> {
|
|||||||
MEDIA_TYPES,
|
MEDIA_TYPES,
|
||||||
);
|
);
|
||||||
await mkdir(MEDIA_ROOT, { recursive: true });
|
await mkdir(MEDIA_ROOT, { recursive: true });
|
||||||
const name =
|
const name = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}.${extension}`;
|
||||||
Date.now() + "-" + Math.random().toString(36).slice(2, 8) + "." + extension;
|
|
||||||
const filePath = resolveMediaPath(name);
|
const filePath = resolveMediaPath(name);
|
||||||
if (!filePath.startsWith(MEDIA_ROOT + path.sep)) throw validation();
|
if (!filePath.startsWith(MEDIA_ROOT + path.sep)) throw validation();
|
||||||
await writeFile(filePath, bytes);
|
await writeFile(filePath, bytes);
|
||||||
return {
|
return {
|
||||||
before: null,
|
before: null,
|
||||||
after: { name, size: file.size, type },
|
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({
|
await logStaffActivity({
|
||||||
staffId: context.capability.actor.id,
|
staffId: context.capability.actor.id,
|
||||||
action: "photo_delete",
|
action: "photo_delete",
|
||||||
description: "Deleted camera photo #" + id,
|
description: `Deleted camera photo #${id}`,
|
||||||
targetType: "camera_web",
|
targetType: "camera_web",
|
||||||
targetId: id,
|
targetId: id,
|
||||||
});
|
});
|
||||||
@@ -459,7 +458,7 @@ async function themeApplyPreset(
|
|||||||
await logStaffActivity({
|
await logStaffActivity({
|
||||||
staffId: context.capability.actor.id,
|
staffId: context.capability.actor.id,
|
||||||
action: "theme_preset",
|
action: "theme_preset",
|
||||||
description: "Applied theme preset " + name,
|
description: `Applied theme preset ${name}`,
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
throw new ContentCommittedExternalFailure(snapshot);
|
throw new ContentCommittedExternalFailure(snapshot);
|
||||||
@@ -504,7 +503,7 @@ async function themeCustomChange(
|
|||||||
await logStaffActivity({
|
await logStaffActivity({
|
||||||
staffId: context.capability.actor.id,
|
staffId: context.capability.actor.id,
|
||||||
action: "theme_preset",
|
action: "theme_preset",
|
||||||
description: "Saved custom theme " + theme.name,
|
description: `Saved custom theme ${theme.name}`,
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
before: id ? { id } : null,
|
before: id ? { id } : null,
|
||||||
@@ -547,7 +546,7 @@ async function themeApplyCustom(
|
|||||||
await logStaffActivity({
|
await logStaffActivity({
|
||||||
staffId: context.capability.actor.id,
|
staffId: context.capability.actor.id,
|
||||||
action: "theme_preset",
|
action: "theme_preset",
|
||||||
description: "Applied custom theme " + theme.name,
|
description: `Applied custom theme ${theme.name}`,
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
throw new ContentCommittedExternalFailure(snapshot);
|
throw new ContentCommittedExternalFailure(snapshot);
|
||||||
@@ -580,13 +579,13 @@ async function faviconSave(input: unknown): Promise<ContentMutationSnapshot> {
|
|||||||
FAVICON_TYPES,
|
FAVICON_TYPES,
|
||||||
);
|
);
|
||||||
const directory = resolveMediaPath("favicon");
|
const directory = resolveMediaPath("favicon");
|
||||||
const filename = "favicon-" + Date.now() + "." + extension;
|
const filename = `favicon-${Date.now()}.${extension}`;
|
||||||
const filePath = path.resolve(directory, filename);
|
const filePath = path.resolve(directory, filename);
|
||||||
if (!filePath.startsWith(directory + path.sep)) throw validation();
|
if (!filePath.startsWith(directory + path.sep)) throw validation();
|
||||||
const oldUrl = await siteSettings.get("cms_favicon");
|
const oldUrl = await siteSettings.get("cms_favicon");
|
||||||
await mkdir(directory, { recursive: true });
|
await mkdir(directory, { recursive: true });
|
||||||
await writeFile(filePath, bytes);
|
await writeFile(filePath, bytes);
|
||||||
const url = "/api/media/favicon/" + filename;
|
const url = `/api/media/favicon/${filename}`;
|
||||||
const snapshot: ContentMutationSnapshot = {
|
const snapshot: ContentMutationSnapshot = {
|
||||||
before: { value: oldUrl ?? null },
|
before: { value: oldUrl ?? null },
|
||||||
after: { value: url },
|
after: { value: url },
|
||||||
@@ -654,7 +653,7 @@ async function logoSave(input: unknown): Promise<ContentMutationSnapshot> {
|
|||||||
const oldUrl = await siteSettings.get("cms_logo");
|
const oldUrl = await siteSettings.get("cms_logo");
|
||||||
await mkdir(directory, { recursive: true });
|
await mkdir(directory, { recursive: true });
|
||||||
await writeFile(filePath, bytes);
|
await writeFile(filePath, bytes);
|
||||||
const url = "/api/media/logo/" + filename;
|
const url = `/api/media/logo/${filename}`;
|
||||||
const snapshot: ContentMutationSnapshot = {
|
const snapshot: ContentMutationSnapshot = {
|
||||||
before: { value: oldUrl ?? null },
|
before: { value: oldUrl ?? null },
|
||||||
after: { value: url },
|
after: { value: url },
|
||||||
@@ -694,7 +693,7 @@ async function cmsTranslationSave(
|
|||||||
process.cwd(),
|
process.cwd(),
|
||||||
"src",
|
"src",
|
||||||
"messages",
|
"messages",
|
||||||
locale + ".json",
|
`${locale}.json`,
|
||||||
);
|
);
|
||||||
await writeFile(filePath, JSON.stringify(translations, null, 2), "utf-8");
|
await writeFile(filePath, JSON.stringify(translations, null, 2), "utf-8");
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ function auditEntry(
|
|||||||
): AuditEntry {
|
): AuditEntry {
|
||||||
return {
|
return {
|
||||||
userId: context.capability.actor.id,
|
userId: context.capability.actor.id,
|
||||||
action: "content." + operation,
|
action: `content.${operation}`,
|
||||||
target: "Content",
|
target: "Content",
|
||||||
correlationId: context.correlationId,
|
correlationId: context.correlationId,
|
||||||
domain: "content",
|
domain: "content",
|
||||||
|
|||||||
Reference in new issue
Block a user