diff --git a/graph/loaders/users.js b/graph/loaders/users.js index 679d3dea5..112fe21bc 100644 --- a/graph/loaders/users.js +++ b/graph/loaders/users.js @@ -1,7 +1,6 @@ const DataLoader = require('dataloader'); const util = require('./util'); -const sc = require('snake-case'); const { SEARCH_OTHER_USERS, @@ -121,7 +120,7 @@ const getUsersByQuery = async ({user}, {limit, cursor, value = '', state, action if (action_type) { query.merge({ - [`action_counts.${sc(action_type.toLowerCase())}`]: { + [`action_counts.${action_type.toLowerCase()}`]: { $gt: 0 } }); @@ -199,7 +198,7 @@ const getCountByQuery = async ({user}, {action_type, state}) => { if (action_type) { query.merge({ - [`action_counts.${sc(action_type.toLowerCase())}`]: { + [`action_counts.${action_type.toLowerCase()}`]: { $gt: 0 } }); diff --git a/plugins/talk-plugin-featured-comments/index.js b/plugins/talk-plugin-featured-comments/index.js index c81afa3ea..2d68bac50 100644 --- a/plugins/talk-plugin-featured-comments/index.js +++ b/plugins/talk-plugin-featured-comments/index.js @@ -57,7 +57,7 @@ module.exports = { hooks: { RootMutation: { addTag: { - async post(obj, {tag: {name, id, item_type}}, {user, mutators: {Comment}, pubsub}, _info) { + async post(obj, {tag: {name, id, item_type}}, {user, mutators: {Comment}, pubsub}) { if (name === 'FEATURED' && item_type === 'COMMENTS') { const comment = await Comment.setStatus({id: id, status: 'ACCEPTED'}); if (comment) { @@ -67,7 +67,7 @@ module.exports = { }, }, removeTag: { - async post(obj, {tag: {name, id, item_type}}, {user, loaders: {Comments}, pubsub}, _info) { + async post(obj, {tag: {name, id, item_type}}, {user, loaders: {Comments}, pubsub}) { if (name === 'FEATURED' && item_type === 'COMMENTS') { const comment = await Comments.get.load(id); if (comment) { diff --git a/services/actions.js b/services/actions.js index adffdd134..cc6f9afa9 100644 --- a/services/actions.js +++ b/services/actions.js @@ -1,7 +1,6 @@ const ActionModel = require('../models/action'); const CommentModel = require('../models/comment'); const UserModel = require('../models/user'); -const sc = require('snake-case'); const _ = require('lodash'); const errors = require('../errors'); const events = require('./events'); @@ -253,14 +252,14 @@ module.exports = class ActionsService { }; const incrActionCounts = async (action, value) => { - const ACTION_TYPE = sc(action.action_type.toLowerCase()); + const ACTION_TYPE = action.action_type.toLowerCase(); const update = { [`action_counts.${ACTION_TYPE}`]: value, }; if (action.group_id && action.group_id.length > 0) { - const GROUP_ID = sc(action.group_id.toLowerCase()); + const GROUP_ID = action.group_id.toLowerCase(); update[`action_counts.${ACTION_TYPE}_${GROUP_ID}`] = value; }