Support live comment edit update

This commit is contained in:
Chi Vinh Le
2017-06-15 22:46:38 +07:00
parent 5ecdfe94cc
commit 303b3ea0f5
15 changed files with 221 additions and 91 deletions
+7 -1
View File
@@ -12,6 +12,7 @@ const {deserializeUser} = require('../services/subscriptions');
const {
SUBSCRIBE_COMMENT_STATUS,
SUBSCRIBE_ALL_COMMENT_EDITS,
} = require('../perms/constants');
/**
@@ -31,7 +32,12 @@ const setupFunctions = plugins.get('server', 'setupFunctions').reduce((acc, {plu
}),
commentEdited: (options, args) => ({
commentEdited: {
filter: (comment) => comment.asset_id === args.asset_id
filter: (comment, context) => {
if (!args.asset_id && (!context.user || !context.user.can(SUBSCRIBE_ALL_COMMENT_EDITS))) {
return false;
}
return !args.asset_id || comment.asset_id === args.asset_id;
}
},
}),
commentStatusChanged: (options, args) => ({