feat: drop the duplicated comment user settings.
This commit is contained in:
parent
62d788af6c
commit
743a13ca54
@ -67,7 +67,6 @@ const Options = z
|
||||
}),
|
||||
comments: z.object({
|
||||
server: z.string().url().readonly(),
|
||||
admins: z.array(z.number()),
|
||||
size: z.number().default(10).readonly(),
|
||||
avatar: z.object({
|
||||
mirror: z.string().url().readonly(),
|
||||
@ -185,7 +184,6 @@ const options: z.input<typeof Options> = {
|
||||
},
|
||||
comments: {
|
||||
server: 'https://comment.yufan.me',
|
||||
admins: [3],
|
||||
size: 10,
|
||||
avatar: {
|
||||
mirror: 'https://weavatar.com/avatar',
|
||||
|
@ -2,7 +2,7 @@ import { db } from '@/helpers/db/pool';
|
||||
import { atk_comments, atk_likes, atk_pages, atk_users } from '@/helpers/db/schema';
|
||||
import { makeToken, urlJoin } from '@/helpers/tools';
|
||||
import options from '@/options';
|
||||
import { and, desc, eq, isNull, notInArray, sql } from 'drizzle-orm';
|
||||
import { and, desc, eq, isNull, not, sql } from 'drizzle-orm';
|
||||
|
||||
export interface Comment {
|
||||
title: string;
|
||||
@ -53,9 +53,9 @@ export const latestComments = async (): Promise<Comment[]> => {
|
||||
authorLink: atk_users.link,
|
||||
})
|
||||
.from(atk_comments)
|
||||
.leftJoin(atk_pages, eq(atk_comments.page_key, atk_pages.key))
|
||||
.leftJoin(atk_users, eq(atk_comments.user_id, atk_users.id))
|
||||
.where(and(notInArray(atk_comments.user_id, options.settings.comments.admins), eq(atk_comments.is_pending, false)))
|
||||
.innerJoin(atk_pages, eq(atk_comments.page_key, atk_pages.key))
|
||||
.innerJoin(atk_users, eq(atk_comments.user_id, atk_users.id))
|
||||
.where(and(not(eq(atk_users.email, options.author.email)), eq(atk_comments.is_pending, false)))
|
||||
.orderBy(desc(atk_comments.created_at))
|
||||
.limit(options.settings.sidebar.comment);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user