diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-19 17:02:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-19 17:02:27 +0200 |
commit | 993cef4b6e000ee425087e5195dfe40cd0840243 (patch) | |
tree | 9bddf4a2f4fad0ac8cbb9d79445c1c1ec36bd305 /server/controllers/api/videos/comment.ts | |
parent | 606c946e74211c4123b16087288902226306198d (diff) | |
download | PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.tar.gz PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.tar.zst PeerTube-993cef4b6e000ee425087e5195dfe40cd0840243.zip |
Refractor audit user identifier
Diffstat (limited to 'server/controllers/api/videos/comment.ts')
-rw-r--r-- | server/controllers/api/videos/comment.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index 8d0692b2b..40ad54d09 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts | |||
@@ -23,7 +23,7 @@ import { | |||
23 | } from '../../../middlewares/validators/video-comments' | 23 | } from '../../../middlewares/validators/video-comments' |
24 | import { VideoModel } from '../../../models/video/video' | 24 | import { VideoModel } from '../../../models/video/video' |
25 | import { VideoCommentModel } from '../../../models/video/video-comment' | 25 | import { VideoCommentModel } from '../../../models/video/video-comment' |
26 | import { auditLoggerFactory, CommentAuditView } from '../../../helpers/audit-logger' | 26 | import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger' |
27 | 27 | ||
28 | const auditLogger = auditLoggerFactory('comments') | 28 | const auditLogger = auditLoggerFactory('comments') |
29 | const videoCommentRouter = express.Router() | 29 | const videoCommentRouter = express.Router() |
@@ -109,7 +109,7 @@ async function addVideoCommentThread (req: express.Request, res: express.Respons | |||
109 | }, t) | 109 | }, t) |
110 | }) | 110 | }) |
111 | 111 | ||
112 | auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new CommentAuditView(comment.toFormattedJSON())) | 112 | auditLogger.create(getAuditIdFromRes(res), new CommentAuditView(comment.toFormattedJSON())) |
113 | 113 | ||
114 | return res.json({ | 114 | return res.json({ |
115 | comment: comment.toFormattedJSON() | 115 | comment: comment.toFormattedJSON() |
@@ -128,7 +128,7 @@ async function addVideoCommentReply (req: express.Request, res: express.Response | |||
128 | }, t) | 128 | }, t) |
129 | }) | 129 | }) |
130 | 130 | ||
131 | auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new CommentAuditView(comment.toFormattedJSON())) | 131 | auditLogger.create(getAuditIdFromRes(res), new CommentAuditView(comment.toFormattedJSON())) |
132 | 132 | ||
133 | return res.json({ | 133 | return res.json({ |
134 | comment: comment.toFormattedJSON() | 134 | comment: comment.toFormattedJSON() |
@@ -143,7 +143,7 @@ async function removeVideoComment (req: express.Request, res: express.Response) | |||
143 | }) | 143 | }) |
144 | 144 | ||
145 | auditLogger.delete( | 145 | auditLogger.delete( |
146 | res.locals.oauth.token.User.Account.Actor.getIdentifier(), | 146 | getAuditIdFromRes(res), |
147 | new CommentAuditView(videoCommentInstance.toFormattedJSON()) | 147 | new CommentAuditView(videoCommentInstance.toFormattedJSON()) |
148 | ) | 148 | ) |
149 | logger.info('Video comment %d deleted.', videoCommentInstance.id) | 149 | logger.info('Video comment %d deleted.', videoCommentInstance.id) |