Ensure action requested status readonly as well
This commit is contained in:
@@ -565,7 +565,8 @@ export const app = new Elysia()
|
|||||||
.post("/:id/request-action", async ({ params: { id }, body: { reviewerNotes, activityVerifications } }) => {
|
.post("/:id/request-action", async ({ params: { id }, body: { reviewerNotes, activityVerifications } }) => {
|
||||||
const verification = await s.Verifications.get(id);
|
const verification = await s.Verifications.get(id);
|
||||||
if (!verification) throw new NotFoundError("Verification not found");
|
if (!verification) throw new NotFoundError("Verification not found");
|
||||||
if (verification.status === "completed") throw status(409, { error: "Cannot modify a completed verification" });
|
if (verification.status === "completed" || verification.status === "action_requested")
|
||||||
|
throw status(409, { error: "Cannot modify a completed or action-requested verification" });
|
||||||
|
|
||||||
const updated = await s.Verifications.requestAction(id, reviewerNotes ?? null, activityVerifications);
|
const updated = await s.Verifications.requestAction(id, reviewerNotes ?? null, activityVerifications);
|
||||||
if (!updated) throw new NotFoundError("Verification not found");
|
if (!updated) throw new NotFoundError("Verification not found");
|
||||||
@@ -579,7 +580,8 @@ export const app = new Elysia()
|
|||||||
.post("/:id/complete", async ({ params: { id }, body: { activityVerifications }, accountId }) => {
|
.post("/:id/complete", async ({ params: { id }, body: { activityVerifications }, accountId }) => {
|
||||||
const verification = await s.Verifications.get(id);
|
const verification = await s.Verifications.get(id);
|
||||||
if (!verification) throw new NotFoundError("Verification not found");
|
if (!verification) throw new NotFoundError("Verification not found");
|
||||||
if (verification.status === "completed") throw status(409, { error: "Cannot modify a completed verification" });
|
if (verification.status === "completed" || verification.status === "action_requested")
|
||||||
|
throw status(409, { error: "Cannot modify a completed or action-requested verification" });
|
||||||
|
|
||||||
const updated = await s.Verifications.complete(id, accountId, activityVerifications);
|
const updated = await s.Verifications.complete(id, accountId, activityVerifications);
|
||||||
if (!updated) throw new NotFoundError("Verification not found");
|
if (!updated) throw new NotFoundError("Verification not found");
|
||||||
|
|||||||
@@ -120,7 +120,10 @@
|
|||||||
ACTIVITIES.filter((a) => verf[a] !== "unset").length,
|
ACTIVITIES.filter((a) => verf[a] !== "unset").length,
|
||||||
);
|
);
|
||||||
const allReviewed = $derived(reviewedCount === ACTIVITIES.length);
|
const allReviewed = $derived(reviewedCount === ACTIVITIES.length);
|
||||||
const isReadOnly = $derived(verification?.status === "completed");
|
const isReadOnly = $derived(
|
||||||
|
verification?.status === "completed" ||
|
||||||
|
verification?.status === "action_requested",
|
||||||
|
);
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
loading = true;
|
loading = true;
|
||||||
@@ -421,9 +424,11 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if isReadOnly}
|
{#if isReadOnly}
|
||||||
<span class="text-sm opacity-70"
|
<span class="text-sm opacity-70">
|
||||||
>This verification is completed and read-only.</span
|
{v.status === "completed"
|
||||||
>
|
? "This verification is completed and read-only."
|
||||||
|
: "This verification is waiting on the player to resubmit and is read-only."}
|
||||||
|
</span>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
{#if !allReviewed}
|
{#if !allReviewed}
|
||||||
|
|||||||
Reference in New Issue
Block a user