fix(housekeeping): address task 14 review round 3
This commit is contained in:
1 parent
c524b305d7
commit
d1160eb65a
7 files changed
+243
-40
No files matched your search
@@ -15,6 +15,8 @@ const ALLOWED = [
|
||||
"image/x-icon",
|
||||
"image/svg+xml",
|
||||
];
|
||||
const PARTIAL_ERROR =
|
||||
"Favicon change completed partially; verify storage and audit state";
|
||||
|
||||
async function executeAuditedFaviconMutation(
|
||||
staff: StaffUser,
|
||||
@@ -59,11 +61,18 @@ export async function saveFavicon(
|
||||
file,
|
||||
});
|
||||
siteRevalidate();
|
||||
const url =
|
||||
typeof result.output?.url === "string" ? result.output.url : undefined;
|
||||
if (result.completion?.status === "partial") {
|
||||
return {
|
||||
success: false,
|
||||
...(url ? { url } : {}),
|
||||
error: PARTIAL_ERROR,
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
...(typeof result.output?.url === "string"
|
||||
? { url: result.output.url }
|
||||
: {}),
|
||||
...(url ? { url } : {}),
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
@@ -79,8 +88,14 @@ export async function deleteFavicon(): Promise<{
|
||||
}> {
|
||||
const staff = await requirePermission(PERMS.SETTINGS_VIEW);
|
||||
try {
|
||||
await executeAuditedFaviconMutation(staff, "favicon.delete", {});
|
||||
const result = await executeAuditedFaviconMutation(
|
||||
staff,
|
||||
"favicon.delete",
|
||||
{},
|
||||
);
|
||||
siteRevalidate();
|
||||
if (result.completion?.status === "partial")
|
||||
return { success: false, error: PARTIAL_ERROR };
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user