Skip to the content

Capsid menu

app/lib/editor/delete-left.mjs

22 lines and 3 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.

Functions

The functions of delete-left.mjs
FunctionLinesComplexityCoveredCRAPMutation
deleteLeftBehind17 to 243100%OkCRAP 3No data: no mutants in this code
<anonymous:21>21 to 211100%OkCRAP 1No data: no mutants in this code
<anonymous:22>22 to 221100%OkCRAP 1No data: no mutants in this code

Imports

It imports no other module of this repo. Imported by app/routes/admin.posts.$slug.edit.tsx, app/routes/admin.posts._index.tsx.

Source

/**
 * What a delete from the editor left behind, carried to /admin/posts on the redirect, because the
 * editor page no longer exists to say it. Fixed codes, never free text in a URL.
 */
export const DELETE_LEFT_PARAM = "left";

/** @type {Record<string, string>} */
const SENTENCES = {
  ask: "Its Ask records were not removed, so Ask can still quote it. Run Sync Ask corpus to prune them.",
  purge: "The cache purge failed, so public pages may still show it until their cache expires.",
};

/**
 * @param {URLSearchParams} params
 * @returns {{ slug: string, problems: string[] } | null}
 */
export function deleteLeftBehind(params) {
  const slug = params.get("deleted");
  const problems = params
    .getAll(DELETE_LEFT_PARAM)
    .map((code) => SENTENCES[code])
    .filter((sentence) => typeof sentence === "string");
  return slug && problems.length > 0 ? { slug, problems } : null;
}