add permission for EDIT_COMMENT

This commit is contained in:
riley
2017-05-16 16:38:30 -06:00
parent d081c0c5b5
commit b49ace99eb
2 changed files with 6 additions and 3 deletions
+3 -3
View File
@@ -99,7 +99,7 @@ const resolveNewCommentStatus = async (context, {asset_id, body}, wordlist = {},
if (wordlist.banned) {
return 'REJECTED';
}
if (settings.premodLinksEnable && linkify.test(body)) {
return 'PREMOD';
}
@@ -229,7 +229,7 @@ const edit = async (context, {id, asset_id, edit: {body}}) => {
const [wordlist, settings] = await filterNewComment(context, {asset_id, body});
// Determine the new status of the comment.
const status = await resolveNewCommentStatus(context, {asset_id, body}, wordlist, settings);
const status = await resolveNewCommentStatus(context, {asset_id, body}, wordlist, settings);
// Execute the edit.
await CommentsService.edit(id, context.user.id, {body, status});
@@ -264,7 +264,7 @@ module.exports = (context) => {
mutators.Comment.removeCommentTag = (action) => removeCommentTag(context, action);
}
if (context.user && context.user.can('mutation:editComment')) {
if (context.user && context.user.can('EDIT_COMMENT')) {
mutators.Comment.edit = (action) => edit(context, action);
}
+3
View File
@@ -8,6 +8,7 @@ module.exports = {
CREATE_ACTION: 'CREATE_ACTION',
DELETE_ACTION: 'DELETE_ACTION',
EDIT_NAME: 'EDIT_NAME',
EDIT_COMMENT: 'EDIT_COMMENT',
SET_USER_STATUS: 'SET_USER_STATUS',
SUSPEND_USER: 'SUSPEND_USER',
SET_COMMENT_STATUS: 'SET_COMMENT_STATUS',
@@ -25,6 +26,8 @@ module.exports = {
return true;
case this.EDIT_NAME:
return true;
case this.EDIT_COMMENT:
return true;
case this.UPDATE_USER_ROLES:
return check(user, ['ADMIN']);
case this.SET_USER_STATUS: