mirror of
https://github.com/wassname/talk.git
synced 2026-08-16 11:29:31 +08:00
Resolve linter issues
This commit is contained in:
@@ -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 });
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user