Add cancel confirmation and cancellable statuses

Introduce a unified CANCELLABLE_STATUSES constant and add confirmation UI for cancelling requests. RequestActionsDropdown and RequestCard now show a ConfirmModal before cancelling and use the shared CANCELLABLE_STATUSES to gate cancel actions. The API route imports the constant to enforce server-side validation and uses Prisma.DbNull for selectedTorrent when withdrawing an awaiting-approval request. Tests updated to expect Prisma.DbNull. Improves UX and centralizes cancel logic to avoid duplicated status lists.
This commit is contained in:
kikootwo
2026-05-15 09:49:42 -04:00
parent 1a9aeb4713
commit b775ccf473
5 changed files with 83 additions and 31 deletions
+2 -1
View File
@@ -4,6 +4,7 @@
*/
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { Prisma } from '@/generated/prisma/client';
import { createPrismaMock } from '../helpers/prisma';
let authRequest: any;
@@ -162,7 +163,7 @@ describe('Request by ID API routes', () => {
expect(payload.request.status).toBe('cancelled');
expect(prismaMock.request.update).toHaveBeenCalledWith(
expect.objectContaining({
data: expect.objectContaining({ selectedTorrent: null }),
data: expect.objectContaining({ selectedTorrent: Prisma.DbNull }),
})
);
expect(jobQueueMock.addNotificationJob).toHaveBeenCalledWith(