Refactor subscriptions

This commit is contained in:
Chi Vinh Le
2017-06-16 22:55:22 +07:00
parent 9573c9a7af
commit 74fbadcc0f
5 changed files with 79 additions and 19 deletions
+12 -2
View File
@@ -57,8 +57,18 @@ const setupFunctions = plugins.get('server', 'setupFunctions').reduce((acc, {plu
}
},
}),
commentStatusChanged: (options, args) => ({
commentStatusChanged: {
commentAccepted: (options, args) => ({
commentAccepted: {
filter: ({comment}, context) => {
if (!context.user || !context.user.can(SUBSCRIBE_COMMENT_STATUS)) {
return false;
}
return !args.asset_id || comment.asset_id === args.asset_id;
}
},
}),
commentRejected: (options, args) => ({
commentRejected: {
filter: ({comment}, context) => {
if (!context.user || !context.user.can(SUBSCRIBE_COMMENT_STATUS)) {
return false;