Skip to content

Commit

Permalink
fix: edit comments api
Browse files Browse the repository at this point in the history
  • Loading branch information
shadrach-tayo committed Feb 5, 2025
1 parent c4d0a75 commit c0ebb45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions desci-server/src/controllers/nodes/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const getGeneralComments = async (req: RequestWithNode, res: Response, _n
};

export const editComment = async (req: RequestWithUser, res: Response) => {
const { id } = req.body as z.infer<typeof editCommentsSchema>['params'];
const { id } = req.params as z.infer<typeof editCommentsSchema>['params'];
const { links, body } = req.body as z.infer<typeof editCommentsSchema>['body'];

const user = req.user;
Expand All @@ -71,7 +71,7 @@ export const editComment = async (req: RequestWithUser, res: Response) => {
logger.trace(`EditComment`);
const comment = await attestationService.editComment({
authorId: parseInt(user.id.toString()),
id,
id: parseInt(id.toString()),
update: { body, links },
});
logger.trace({ comment }, `EditCommentedComment`);
Expand Down
1 change: 0 additions & 1 deletion desci-server/src/services/Attestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,6 @@ export class AttestationService {
const comment = await prisma.annotation.findFirst({ where: { id } });
if (!comment) throw new CommentNotFoundError();

logger.trace({ commentAuthor: comment.authorId, authorId }, 'Inspect authors');
if (comment.authorId !== authorId) throw new ForbiddenError();

if (comment.nodeAttestationId) {
Expand Down

0 comments on commit c0ebb45

Please sign in to comment.