Skip to content

Commit

Permalink
Smol refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-sherman committed Nov 5, 2024
1 parent 7907525 commit 6ba02e4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/frontpage/app/api/receive_hook/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { atprotoGetRecord } from "@/lib/data/atproto/record";
import { Commit } from "@/lib/data/atproto/event";
import * as atprotoPost from "@/lib/data/atproto/post";
import * as dbPost from "@/lib/data/db/post";
import { CommentCollection, getComment } from "@/lib/data/atproto/comment";
import * as atprotoComment from "@/lib/data/atproto/comment";
import { VoteRecord } from "@/lib/data/atproto/vote";
import { getPdsUrl } from "@/lib/data/atproto/did";
import {
Expand Down Expand Up @@ -64,9 +64,9 @@ export async function POST(request: Request) {
}
}
// repo is actually the did of the user
if (collection === CommentCollection) {
if (collection === atprotoComment.CommentCollection) {
if (op.action === "create") {
const comment = await getComment({ rkey, repo });
const comment = await atprotoComment.getComment({ rkey, repo });

await unauthed_createComment({
cid: comment.cid,
Expand Down Expand Up @@ -104,7 +104,8 @@ export async function POST(request: Request) {
cid: hydratedRecord.cid,
});
} else if (
hydratedVoteRecordValue.subject.uri.collection === CommentCollection
hydratedVoteRecordValue.subject.uri.collection ===
atprotoComment.CommentCollection
) {
await unauthed_createCommentVote({
cid: hydratedRecord.cid,
Expand Down

0 comments on commit 6ba02e4

Please sign in to comment.