mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
Merge branch 'master' into csrf
This commit is contained in:
@@ -104,7 +104,7 @@ router.post('/', parseForm, csrfProtection, wordlist.filter('body'), (req, res,
|
||||
// premod, set it to `premod`.
|
||||
let status;
|
||||
|
||||
if (req.wordlist.matched) {
|
||||
if (req.wordlist.banned) {
|
||||
status = Promise.resolve('rejected');
|
||||
} else {
|
||||
status = Asset
|
||||
@@ -142,6 +142,15 @@ router.post('/', parseForm, csrfProtection, wordlist.filter('body'), (req, res,
|
||||
status,
|
||||
author_id: req.user.id
|
||||
}))
|
||||
.then((comment) => {
|
||||
if (req.wordlist.suspect) {
|
||||
return Comment
|
||||
.addAction(comment.id, null, 'flag', 'body', 'Matched suspect word filters.')
|
||||
.then(() => comment);
|
||||
}
|
||||
|
||||
return comment;
|
||||
})
|
||||
.then((comment) => {
|
||||
|
||||
// The comment was created! Send back the created comment.
|
||||
@@ -198,12 +207,11 @@ router.post('/:comment_id/actions', parseForm, csrfProtection, (req, res, next)
|
||||
|
||||
const {
|
||||
action_type,
|
||||
field,
|
||||
detail
|
||||
metadata
|
||||
} = req.body;
|
||||
|
||||
Comment
|
||||
.addAction(req.params.comment_id, req.user.id, action_type, field, detail)
|
||||
.addAction(req.params.comment_id, req.user.id, action_type, metadata)
|
||||
.then((action) => {
|
||||
res.status(201).json(action);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user