feat(comments) : add newest and oldest sorting to admin inbox
This commit is contained in:
@@ -136,7 +136,7 @@ export async function listComments(options: {
|
||||
where reply.root_id = ${comments.id} and author.role = 'admin' and author.email_verified and not reply.hidden and reply.deleted_at is null)`);
|
||||
const cursor = decodeCursor(options.cursor ?? null);
|
||||
const top = !options.inbox && !options.rootId && options.sort === "top";
|
||||
const ascending = Boolean(options.rootId);
|
||||
const ascending = Boolean(options.rootId || (options.inbox && options.sort === "oldest"));
|
||||
const timeBefore = cursor ? sql`(${comments.createdAt}, ${comments.id}) < (${cursor.time}::timestamptz, ${cursor.id}::uuid)` : undefined;
|
||||
if (cursor) conditions.push(top
|
||||
? or(sql`${likes} < ${cursor.likes}`, and(sql`${likes} = ${cursor.likes}`, timeBefore))!
|
||||
|
||||
Reference in New Issue
Block a user