fix recent comments

This commit is contained in:
keyan 2023-05-04 19:19:08 -05:00
parent 83a4568ec4
commit abd9555792
2 changed files with 6 additions and 4 deletions

View File

@ -235,7 +235,7 @@ export default {
${recentClause(type)} ${recentClause(type)}
ORDER BY created_at DESC ORDER BY created_at DESC
OFFSET $2 OFFSET $2
LIMIT ${LIMIT}`, decodedCursor.time, decodedCursor.offset, sub || 'NULL') LIMIT ${LIMIT}`, decodedCursor.time, decodedCursor.offset, sub)
break break
case 'top': case 'top':
items = await models.$queryRaw(` items = await models.$queryRaw(`
@ -440,7 +440,7 @@ export default {
FROM "Item" FROM "Item"
JOIN "Item" root ON "Item"."rootId" = root.id JOIN "Item" root ON "Item"."rootId" = root.id
WHERE "Item"."parentId" IS NOT NULL AND "Item".created_at <= $1 WHERE "Item"."parentId" IS NOT NULL AND "Item".created_at <= $1
AND (root."subName" = $3 OR (root."subName" IS NULL AND $3 IS NULL)) AND (root."subName" = $3 OR (root."subName" IS NOT NULL AND $3 IS NULL))
${await filterClause(me, models)} ${await filterClause(me, models)}
ORDER BY "Item".created_at DESC ORDER BY "Item".created_at DESC
OFFSET $2 OFFSET $2
@ -472,13 +472,12 @@ export default {
FROM "Item" FROM "Item"
JOIN "Item" root ON "Item"."rootId" = root.id JOIN "Item" root ON "Item"."rootId" = root.id
WHERE "Item"."parentId" IS NOT NULL AND"Item"."deletedAt" IS NULL WHERE "Item"."parentId" IS NOT NULL AND"Item"."deletedAt" IS NULL
AND (root."subName" = $3 OR (root."subName" IS NULL AND $3 IS NULL))
AND "Item".created_at <= $1 AND "Item".created_at <= $1
${topClause(within)} ${topClause(within)}
${await filterClause(me, models)} ${await filterClause(me, models)}
${await topOrderByWeightedSats(me, models)} ${await topOrderByWeightedSats(me, models)}
OFFSET $2 OFFSET $2
LIMIT ${LIMIT}`, decodedCursor.time, decodedCursor.offset, sub) LIMIT ${LIMIT}`, decodedCursor.time, decodedCursor.offset)
break break
default: default:
throw new UserInputError('invalid sort type', { argumentName: 'sort' }) throw new UserInputError('invalid sort type', { argumentName: 'sort' })

View File

@ -31,6 +31,9 @@ export const COMMENT_FIELDS = gql`
title title
bounty bounty
bountyPaidTo bountyPaidTo
sub {
name
}
user { user {
name name
streak streak