Resolve linter issues

This commit is contained in:
Chi Vinh Le
2018-06-05 04:28:54 +02:00
parent d9a1d739dc
commit ccff6ed63b
148 changed files with 1171 additions and 265 deletions
+16 -3
View File
@@ -11,7 +11,9 @@ const { IGNORE_FLAGS_AGAINST_STAFF } = require('../../config');
* @return {Promise} resolves to the referenced item
*/
const getActionItem = async (ctx, { item_id, item_type }) => {
const { loaders: { Comments, Users } } = ctx;
const {
loaders: { Comments, Users },
} = ctx;
switch (item_type) {
case 'COMMENTS': {
@@ -42,7 +44,13 @@ const createAction = async (
ctx,
{ item_id, item_type, action_type, group_id, metadata = {} }
) => {
const { user = {}, pubsub, connectors: { services: { Actions } } } = ctx;
const {
user = {},
pubsub,
connectors: {
services: { Actions },
},
} = ctx;
// Gets the item referenced by the action.
const item = await getActionItem(ctx, { item_id, item_type });
@@ -107,7 +115,12 @@ const createAction = async (
* @return {Promise} resolves to the deleted action, or null if not found.
*/
const deleteAction = (ctx, { id }) => {
const { user, connectors: { services: { Actions } } } = ctx;
const {
user,
connectors: {
services: { Actions },
},
} = ctx;
return Actions.delete({ id, user_id: user.id });
};
+5 -1
View File
@@ -63,7 +63,11 @@ const closeNow = async (ctx, id) =>
* @param {String} id the asset's id to scrape
*/
const scrapeAsset = async (ctx, id) => {
const { connectors: { services: { Scraper } } } = ctx;
const {
connectors: {
services: { Scraper },
},
} = ctx;
return Scraper.create(ctx, id);
};
+23 -5
View File
@@ -14,7 +14,10 @@ const {
} = require('../../perms/constants');
const resolveTagsForComment = async (ctx, { asset_id, tags = [] }) => {
const { user, loaders: { Tags } } = ctx;
const {
user,
loaders: { Tags },
} = ctx;
const item_type = 'COMMENTS';
// Handle Tags
@@ -156,7 +159,11 @@ const createComment = async (
metadata = {},
}
) => {
const { user, loaders: { Comments }, pubsub } = ctx;
const {
user,
loaders: { Comments },
pubsub,
} = ctx;
// Resolve the tags for the comment.
tags = await resolveTagsForComment(ctx, { asset_id, tags });
@@ -202,7 +209,11 @@ const createComment = async (
* @return {Promise} resolves to a new comment
*/
const createPublicComment = async (ctx, comment) => {
const { connectors: { services: { Moderation } } } = ctx;
const {
connectors: {
services: { Moderation },
},
} = ctx;
// We then take the wordlist and the comment into consideration when
// considering what status to assign the new comment, and resolve the new
@@ -245,7 +256,10 @@ const createActions = async (item_id, actions = []) =>
* @param {String} status the new status of the comment
*/
const setStatus = async (ctx, { id, status }) => {
const { user, loaders: { Comments } } = ctx;
const {
user,
loaders: { Comments },
} = ctx;
let comment = await CommentsService.pushStatus(
id,
@@ -281,7 +295,11 @@ const editComment = async (
ctx,
{ id, asset_id, edit: { body, metadata = {} } }
) => {
const { connectors: { services: { Moderation } } } = ctx;
const {
connectors: {
services: { Moderation },
},
} = ctx;
// Build up the new comment we're setting. We need to check this with
// moderation now.
+8 -2
View File
@@ -92,7 +92,11 @@ const actionDecrTransformer = ({ item_id, action_type, group_id }) => {
// delUser will delete a given user with the specified id.
const delUser = async (ctx, id) => {
const { connectors: { models: { User, Action, Comment } } } = ctx;
const {
connectors: {
models: { User, Action, Comment },
},
} = ctx;
// Find the user we're removing.
const user = await User.findOne({ id });
@@ -178,7 +182,9 @@ const changeUserPassword = async (ctx, oldPassword, newPassword) => {
const {
user,
loaders: { Settings },
connectors: { services: { I18n } },
connectors: {
services: { I18n },
},
} = ctx;
// Verify the old password.