feat : copy youtube studio
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { after } from "next/server";
|
||||
import { sendCommentPush } from "@/lib/comments/push";
|
||||
import { authorizeComment, commentId, getCommentViewer, listComments, mutateComment, requireCommentViewer } from "@/lib/comments/repository";
|
||||
import { publishComment } from "@/lib/comments/publish";
|
||||
import { errorResponse, requireSameOrigin } from "@/lib/security/http";
|
||||
@@ -18,7 +20,9 @@ export async function PATCH(request: Request, context: Context) {
|
||||
requireSameOrigin(request);
|
||||
const viewer = await requireCommentViewer();
|
||||
await limitRequest("comment-publish", viewer.id, 20);
|
||||
return Response.json(await publishComment(request, viewer, { id: commentId((await context.params).id) }));
|
||||
const result = await publishComment(request, viewer, { id: commentId((await context.params).id) });
|
||||
after(async () => { await sendCommentPush(result.id, result.version).catch(() => console.error("Comment notification failed")); });
|
||||
return Response.json(result);
|
||||
} catch (cause) { return errorResponse(cause); }
|
||||
}
|
||||
export async function DELETE(request: Request, context: Context) {
|
||||
|
||||
Reference in New Issue
Block a user