Fix moderation queue query

This commit is contained in:
gpt-engineer-app[bot]
2025-10-29 13:00:33 +00:00
parent beb2a17312
commit 7b6dfc4741

View File

@@ -137,8 +137,9 @@ export function buildSubmissionQuery(
// Admins see all submissions // Admins see all submissions
if (!isAdmin && !isSuperuser) { if (!isAdmin && !isSuperuser) {
const now = new Date().toISOString(); const now = new Date().toISOString();
// Fixed: Add null check for locked_until to prevent 400 error
query = query.or( query = query.or(
`assigned_to.is.null,locked_until.lt.${now},assigned_to.eq.${userId}` `assigned_to.is.null,and(locked_until.not.is.null,locked_until.lt.${now}),assigned_to.eq.${userId}`
); );
} }
@@ -189,8 +190,9 @@ export function buildCountQuery(
if (!isAdmin && !isSuperuser) { if (!isAdmin && !isSuperuser) {
const now = new Date().toISOString(); const now = new Date().toISOString();
// Fixed: Add null check for locked_until to prevent 400 error
countQuery = countQuery.or( countQuery = countQuery.or(
`assigned_to.is.null,locked_until.lt.${now},assigned_to.eq.${userId}` `assigned_to.is.null,and(locked_until.not.is.null,locked_until.lt.${now}),assigned_to.eq.${userId}`
); );
} }