Merge branch 'master' into graph-tests

This commit is contained in:
Wyatt Johnson
2017-02-17 15:50:21 -07:00
committed by GitHub
31 changed files with 316 additions and 166 deletions
+17
View File
@@ -39,6 +39,23 @@ const RootQuery = {
return Comments.getByQuery(query);
},
commentCount(_, {query: {action_type, statuses, asset_id, parent_id}}, {user, loaders: {Actions, Comments}}) {
if (user == null || !user.hasRoles('ADMIN')) {
return null;
}
if (action_type) {
return Actions.getByTypes({action_type, item_type: 'COMMENTS'})
.then((ids) => {
// Perform the query using the available resolver.
return Comments.getCountByQuery({ids, statuses, asset_id, parent_id});
});
}
return Comments.getCountByQuery({statuses, asset_id, parent_id});
},
metrics(_, {from, to, sort, limit = 10}, {user, loaders: {Metrics}}) {
if (user == null || !user.hasRoles('ADMIN')) {
return null;