mirror of
https://github.com/wassname/talk.git
synced 2026-08-02 13:10:23 +08:00
BE Subscription for Featured Comments
This commit is contained in:
@@ -24,6 +24,7 @@ const {
|
||||
SUBSCRIBE_ALL_USER_SUSPENDED,
|
||||
SUBSCRIBE_ALL_USER_BANNED,
|
||||
SUBSCRIBE_ALL_USERNAME_REJECTED,
|
||||
SUBSCRIBE_COMMENT_FEATURED
|
||||
} = require('../perms/constants');
|
||||
|
||||
/**
|
||||
@@ -86,6 +87,16 @@ const setupFunctions = plugins.get('server', 'setupFunctions').reduce((acc, {plu
|
||||
}
|
||||
},
|
||||
}),
|
||||
commentFeatured: (options, args) => ({
|
||||
commentFeatured: {
|
||||
filter: (comment, context) => {
|
||||
if (!args.asset_id && (!context.user || !context.user.can(SUBSCRIBE_COMMENT_FEATURED))) {
|
||||
return false;
|
||||
}
|
||||
return !args.asset_id || comment.asset_id === args.asset_id;
|
||||
}
|
||||
},
|
||||
}),
|
||||
userSuspended: (options, args) => ({
|
||||
userSuspended: {
|
||||
filter: (user, context) => {
|
||||
|
||||
Reference in New Issue
Block a user