diff options
author | lutangar <johan.dufour@gmail.com> | 2021-11-24 14:33:14 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-11-25 09:54:22 +0100 |
commit | 7226e90fdc61a3c6cad5ccab18b6707d55cf0992 (patch) | |
tree | 0bdd7304352b1af2d9ae87439486a138e02d46e8 /server/controllers/api/videos/comment.ts | |
parent | 5098098d96164c93f84ec8419e98fbd83ba8dc71 (diff) | |
download | PeerTube-7226e90fdc61a3c6cad5ccab18b6707d55cf0992.tar.gz PeerTube-7226e90fdc61a3c6cad5ccab18b6707d55cf0992.tar.zst PeerTube-7226e90fdc61a3c6cad5ccab18b6707d55cf0992.zip |
Add `req` and `res` as controllers hooks parameters
Hooks prefixed by `action:api` now give access the original express req and res.
Checkout guide.md for possible usage.
Diffstat (limited to 'server/controllers/api/videos/comment.ts')
-rw-r--r-- | server/controllers/api/videos/comment.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index 23bba9089..47fa2f2e2 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts | |||
@@ -192,7 +192,7 @@ async function addVideoCommentThread (req: express.Request, res: express.Respons | |||
192 | Notifier.Instance.notifyOnNewComment(comment) | 192 | Notifier.Instance.notifyOnNewComment(comment) |
193 | auditLogger.create(getAuditIdFromRes(res), new CommentAuditView(comment.toFormattedJSON())) | 193 | auditLogger.create(getAuditIdFromRes(res), new CommentAuditView(comment.toFormattedJSON())) |
194 | 194 | ||
195 | Hooks.runAction('action:api.video-thread.created', { comment }) | 195 | Hooks.runAction('action:api.video-thread.created', { comment, req, res }) |
196 | 196 | ||
197 | return res.json({ comment: comment.toFormattedJSON() }) | 197 | return res.json({ comment: comment.toFormattedJSON() }) |
198 | } | 198 | } |
@@ -214,7 +214,7 @@ async function addVideoCommentReply (req: express.Request, res: express.Response | |||
214 | Notifier.Instance.notifyOnNewComment(comment) | 214 | Notifier.Instance.notifyOnNewComment(comment) |
215 | auditLogger.create(getAuditIdFromRes(res), new CommentAuditView(comment.toFormattedJSON())) | 215 | auditLogger.create(getAuditIdFromRes(res), new CommentAuditView(comment.toFormattedJSON())) |
216 | 216 | ||
217 | Hooks.runAction('action:api.video-comment-reply.created', { comment }) | 217 | Hooks.runAction('action:api.video-comment-reply.created', { comment, req, res }) |
218 | 218 | ||
219 | return res.json({ comment: comment.toFormattedJSON() }) | 219 | return res.json({ comment: comment.toFormattedJSON() }) |
220 | } | 220 | } |
@@ -222,7 +222,7 @@ async function addVideoCommentReply (req: express.Request, res: express.Response | |||
222 | async function removeVideoComment (req: express.Request, res: express.Response) { | 222 | async function removeVideoComment (req: express.Request, res: express.Response) { |
223 | const videoCommentInstance = res.locals.videoCommentFull | 223 | const videoCommentInstance = res.locals.videoCommentFull |
224 | 224 | ||
225 | await removeComment(videoCommentInstance) | 225 | await removeComment(videoCommentInstance, req, res) |
226 | 226 | ||
227 | auditLogger.delete(getAuditIdFromRes(res), new CommentAuditView(videoCommentInstance.toFormattedJSON())) | 227 | auditLogger.delete(getAuditIdFromRes(res), new CommentAuditView(videoCommentInstance.toFormattedJSON())) |
228 | 228 | ||