diff --git a/src/controllers/CommentsController.ts b/src/controllers/CommentsController.ts index 61bc048..5f81064 100644 --- a/src/controllers/CommentsController.ts +++ b/src/controllers/CommentsController.ts @@ -76,6 +76,19 @@ export class CommentsController { h.success() } + /** + * Delete a comment + * + * @param h Request handler + */ + public static async Delete(h: RequestHandler) { + const commentID = await this.GetPostCommentIDWithFullAccess(h, "commentID"); + + await CommentsHelper.Delete(await CommentsHelper.GetSingle(commentID)); + + h.success(); + } + /** * Get the content of a comment included in a POST field * diff --git a/src/controllers/Routes.ts b/src/controllers/Routes.ts index 175858e..727015a 100644 --- a/src/controllers/Routes.ts +++ b/src/controllers/Routes.ts @@ -211,6 +211,8 @@ export const Routes : Route[] = [ {path: "/comments/edit", cb: (h) => CommentsController.Edit(h)}, + {path: "/comments/delete", cb: (h) => CommentsController.Delete(h)}, + // Notifications controller {path: "/notifications/count_unread", cb: (h) => NotificationsController.CountUnread(h)},