diff --git a/bin/cli-plugins b/bin/cli-plugins index f2e76de21..85132c39d 100755 --- a/bin/cli-plugins +++ b/bin/cli-plugins @@ -329,8 +329,7 @@ async function createSeedPlugin() { if (answers.addPluginsJson) { const pluginsJson = path.resolve(__dirname, '..', 'plugins.json'); - fs - .readJson(pluginsJson) + fs.readJson(pluginsJson) .then(j => { // This is a client-side plugin, let's push this. if (answers.client) { diff --git a/bin/cli-token b/bin/cli-token index 0d4dc4e10..2590ec106 100755 --- a/bin/cli-token +++ b/bin/cli-token @@ -49,7 +49,10 @@ async function revokeToken(tokenID) { async function createToken(userID, tokenName) { try { - let { pat: { id }, jwt } = await TokensService.create(userID, tokenName); + let { + pat: { id }, + jwt, + } = await TokensService.create(userID, tokenName); console.log(`Created Token[${id}] for User[${userID}] = ${jwt}`); diff --git a/client/coral-admin/src/components/BanUserDialog.js b/client/coral-admin/src/components/BanUserDialog.js index f211a9f2c..fd8636320 100644 --- a/client/coral-admin/src/components/BanUserDialog.js +++ b/client/coral-admin/src/components/BanUserDialog.js @@ -19,7 +19,9 @@ class BanUserDialog extends React.Component { } handleMessageChange = e => { - const { target: { value: message } } = e; + const { + target: { value: message }, + } = e; this.setState({ message }); }; diff --git a/client/coral-admin/src/components/KarmaTooltip.js b/client/coral-admin/src/components/KarmaTooltip.js index 9c4184afd..d27597325 100644 --- a/client/coral-admin/src/components/KarmaTooltip.js +++ b/client/coral-admin/src/components/KarmaTooltip.js @@ -27,7 +27,9 @@ class KarmaTooltip extends React.Component { }; render() { - const { thresholds: { unreliable } } = this.props; + const { + thresholds: { unreliable }, + } = this.props; const { menuVisible } = this.state; return ( @@ -68,6 +70,7 @@ class KarmaTooltip extends React.Component { className={styles.link} href={t('user_detail.karma_docs_link')} target="_blank" + rel="noopener noreferrer" > {t('user_detail.learn_more')} diff --git a/client/coral-admin/src/components/UserDetail.js b/client/coral-admin/src/components/UserDetail.js index 92157f4fd..d8193c121 100644 --- a/client/coral-admin/src/components/UserDetail.js +++ b/client/coral-admin/src/components/UserDetail.js @@ -159,7 +159,7 @@ class UserDetail extends React.Component { } = this.props; // if totalComments is 0, you're dividing by zero - let rejectedPercent = rejectedComments / totalComments * 100; + let rejectedPercent = (rejectedComments / totalComments) * 100; if (rejectedPercent === Infinity || isNaN(rejectedPercent)) { rejectedPercent = 0; diff --git a/client/coral-admin/src/components/UserDetailComment.js b/client/coral-admin/src/components/UserDetailComment.js index 41fb87b28..e8472219a 100644 --- a/client/coral-admin/src/components/UserDetailComment.js +++ b/client/coral-admin/src/components/UserDetailComment.js @@ -114,6 +114,7 @@ class UserDetailComment extends React.Component { className={styles.external} href={`${comment.asset.url}?commentId=${comment.id}`} target="_blank" + rel="noopener noreferrer" > {t('comment.view_context')} diff --git a/client/coral-admin/src/components/UserDetailCommentList.js b/client/coral-admin/src/components/UserDetailCommentList.js index 3a31ee3f9..3a5c7462d 100644 --- a/client/coral-admin/src/components/UserDetailCommentList.js +++ b/client/coral-admin/src/components/UserDetailCommentList.js @@ -10,7 +10,10 @@ import ApproveButton from './ApproveButton'; const UserDetailCommentList = props => { const { root, - root: { user, comments: { nodes, hasNextPage } }, + root: { + user, + comments: { nodes, hasNextPage }, + }, acceptComment, rejectComment, selectedCommentIds, diff --git a/client/coral-admin/src/containers/BanUserDialog.js b/client/coral-admin/src/containers/BanUserDialog.js index c869626c9..e1b053337 100644 --- a/client/coral-admin/src/containers/BanUserDialog.js +++ b/client/coral-admin/src/containers/BanUserDialog.js @@ -77,7 +77,10 @@ const mapDispatchToProps = dispatch => ({ }); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withBanUser, withSetCommentStatus )(BanUserDialogContainer); diff --git a/client/coral-admin/src/containers/Layout.js b/client/coral-admin/src/containers/Layout.js index d8ca11732..22c624b7d 100644 --- a/client/coral-admin/src/containers/Layout.js +++ b/client/coral-admin/src/containers/Layout.js @@ -81,4 +81,7 @@ const mapDispatchToProps = dispatch => dispatch ); -export default connect(mapStateToProps, mapDispatchToProps)(LayoutContainer); +export default connect( + mapStateToProps, + mapDispatchToProps +)(LayoutContainer); diff --git a/client/coral-admin/src/containers/RejectUsernameDialog.js b/client/coral-admin/src/containers/RejectUsernameDialog.js index 24d1cd2d3..ec996a9d5 100644 --- a/client/coral-admin/src/containers/RejectUsernameDialog.js +++ b/client/coral-admin/src/containers/RejectUsernameDialog.js @@ -83,7 +83,10 @@ const mapDispatchToProps = dispatch => ({ }); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withRejectUsername, withPostFlag({ notifyOnError: false }) )(RejectUsernameDialogContainer); diff --git a/client/coral-admin/src/containers/SignIn.js b/client/coral-admin/src/containers/SignIn.js index 1af857294..365b32db3 100644 --- a/client/coral-admin/src/containers/SignIn.js +++ b/client/coral-admin/src/containers/SignIn.js @@ -55,4 +55,7 @@ SignInContainer.propTypes = { requireRecaptcha: PropTypes.bool.isRequired, }; -export default compose(withSignIn, withPopupAuthHandler)(SignInContainer); +export default compose( + withSignIn, + withPopupAuthHandler +)(SignInContainer); diff --git a/client/coral-admin/src/containers/SuspendUserDialog.js b/client/coral-admin/src/containers/SuspendUserDialog.js index f03d48f52..1d3d5d2c0 100644 --- a/client/coral-admin/src/containers/SuspendUserDialog.js +++ b/client/coral-admin/src/containers/SuspendUserDialog.js @@ -86,7 +86,10 @@ const mapDispatchToProps = dispatch => ({ }); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withSuspendUser, withSetCommentStatus, withOrganizationName diff --git a/client/coral-admin/src/containers/UserDetail.js b/client/coral-admin/src/containers/UserDetail.js index 03ffee007..e9ffea4d1 100644 --- a/client/coral-admin/src/containers/UserDetail.js +++ b/client/coral-admin/src/containers/UserDetail.js @@ -294,7 +294,10 @@ const mapDispatchToProps = dispatch => ({ }); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withUserDetailQuery, withSetCommentStatus, withUnbanUser, diff --git a/client/coral-admin/src/graphql/index.js b/client/coral-admin/src/graphql/index.js index b51897a4b..9fca9f497 100644 --- a/client/coral-admin/src/graphql/index.js +++ b/client/coral-admin/src/graphql/index.js @@ -66,7 +66,11 @@ export default { }); }, }), - SuspendUser: ({ variables: { input: { id, until } } }) => ({ + SuspendUser: ({ + variables: { + input: { id, until }, + }, + }) => ({ update: proxy => { const fragmentId = `User_${id}`; @@ -92,7 +96,11 @@ export default { }); }, }), - UnsuspendUser: ({ variables: { input: { id } } }) => ({ + UnsuspendUser: ({ + variables: { + input: { id }, + }, + }) => ({ update: proxy => { const fragmentId = `User_${id}`; const data = proxy.readFragment({ @@ -117,7 +125,11 @@ export default { }); }, }), - BanUser: ({ variables: { input: { id } } }) => ({ + BanUser: ({ + variables: { + input: { id }, + }, + }) => ({ update: proxy => { const fragmentId = `User_${id}`; const data = proxy.readFragment({ @@ -142,7 +154,11 @@ export default { }); }, }), - UnbanUser: ({ variables: { input: { id } } }) => ({ + UnbanUser: ({ + variables: { + input: { id }, + }, + }) => ({ update: proxy => { const fragmentId = `User_${id}`; const data = proxy.readFragment({ diff --git a/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js b/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js index 60ae4ee99..328030390 100644 --- a/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js +++ b/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js @@ -46,7 +46,11 @@ class FlaggedAccountsContainer extends Component { document: USERNAME_FLAGGED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { usernameFlagged: user } } } + { + subscriptionData: { + data: { usernameFlagged: user }, + }, + } ) => { return handleFlaggedAccountsChange(prev, user, () => { const msg = t( @@ -62,7 +66,11 @@ class FlaggedAccountsContainer extends Component { document: USERNAME_APPROVED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { usernameApproved: user } } } + { + subscriptionData: { + data: { usernameApproved: user }, + }, + } ) => { return handleFlaggedAccountsChange(prev, user, () => { const msg = t( @@ -78,7 +86,11 @@ class FlaggedAccountsContainer extends Component { document: USERNAME_REJECTED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { usernameRejected: user } } } + { + subscriptionData: { + data: { usernameRejected: user }, + }, + } ) => { return handleFlaggedAccountsChange(prev, user, () => { const msg = t( @@ -96,7 +108,9 @@ class FlaggedAccountsContainer extends Component { prev, { subscriptionData: { - data: { usernameChanged: { previousUsername, user } }, + data: { + usernameChanged: { previousUsername, user }, + }, }, } ) => { @@ -297,7 +311,10 @@ const mapDispatchToProps = dispatch => ); export default compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withApproveUsername, withQuery( gql` diff --git a/client/coral-admin/src/routes/Community/containers/Indicator.js b/client/coral-admin/src/routes/Community/containers/Indicator.js index 3c078a8d7..3db93cdd0 100644 --- a/client/coral-admin/src/routes/Community/containers/Indicator.js +++ b/client/coral-admin/src/routes/Community/containers/Indicator.js @@ -15,7 +15,11 @@ class IndicatorContainer extends Component { document: USERNAME_FLAGGED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { usernameFlagged: user } } } + { + subscriptionData: { + data: { usernameFlagged: user }, + }, + } ) => { return handleIndicatorChange(prev, user); }, @@ -24,7 +28,11 @@ class IndicatorContainer extends Component { document: USERNAME_APPROVED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { usernameApproved: user } } } + { + subscriptionData: { + data: { usernameApproved: user }, + }, + } ) => { return handleIndicatorChange(prev, user); }, @@ -33,7 +41,11 @@ class IndicatorContainer extends Component { document: USERNAME_REJECTED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { usernameRejected: user } } } + { + subscriptionData: { + data: { usernameRejected: user }, + }, + } ) => { return handleIndicatorChange(prev, user); }, @@ -42,7 +54,13 @@ class IndicatorContainer extends Component { document: USERNAME_CHANGED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { usernameChanged: { user } } } } + { + subscriptionData: { + data: { + usernameChanged: { user }, + }, + }, + } ) => { return handleIndicatorChange(prev, user); }, diff --git a/client/coral-admin/src/routes/Community/containers/People.js b/client/coral-admin/src/routes/Community/containers/People.js index f8271b236..63cd28833 100644 --- a/client/coral-admin/src/routes/Community/containers/People.js +++ b/client/coral-admin/src/routes/Community/containers/People.js @@ -200,7 +200,10 @@ const SEARCH_QUERY = gql` `; export default compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withSetUserRole, withUnsuspendUser, withUnbanUser, diff --git a/client/coral-admin/src/routes/Community/containers/RejectUsernameDialog.js b/client/coral-admin/src/routes/Community/containers/RejectUsernameDialog.js index 325eadfb5..a09bf117e 100644 --- a/client/coral-admin/src/routes/Community/containers/RejectUsernameDialog.js +++ b/client/coral-admin/src/routes/Community/containers/RejectUsernameDialog.js @@ -19,6 +19,9 @@ const mapDispatchToProps = dispatch => ); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withRejectUsername )(RejectUsernameDialog); diff --git a/client/coral-admin/src/routes/Configure/containers/Configure.js b/client/coral-admin/src/routes/Configure/containers/Configure.js index 3d2789974..758a78963 100644 --- a/client/coral-admin/src/routes/Configure/containers/Configure.js +++ b/client/coral-admin/src/routes/Configure/containers/Configure.js @@ -174,7 +174,10 @@ const mapDispatchToProps = dispatch => export default compose( withRouter, - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withUpdateSettings, withConfigureQuery, withMergedSettings('root.settings', 'pending', 'mergedSettings') diff --git a/client/coral-admin/src/routes/Configure/containers/ModerationSettings.js b/client/coral-admin/src/routes/Configure/containers/ModerationSettings.js index 8882477d1..80f1abe9c 100644 --- a/client/coral-admin/src/routes/Configure/containers/ModerationSettings.js +++ b/client/coral-admin/src/routes/Configure/containers/ModerationSettings.js @@ -42,7 +42,10 @@ export default compose( } `, }), - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), mapProps(({ root, settings, updatePending, errors, ...rest }) => ({ slotPassthrough: { root, diff --git a/client/coral-admin/src/routes/Configure/containers/OrganizationSettings.js b/client/coral-admin/src/routes/Configure/containers/OrganizationSettings.js index 79ab70f69..6f3299dea 100644 --- a/client/coral-admin/src/routes/Configure/containers/OrganizationSettings.js +++ b/client/coral-admin/src/routes/Configure/containers/OrganizationSettings.js @@ -37,7 +37,10 @@ export default compose( } `, }), - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), mapProps(({ root, settings, updatePending, errors, ...rest }) => ({ slotPassthrough: { root, diff --git a/client/coral-admin/src/routes/Configure/containers/StreamSettings.js b/client/coral-admin/src/routes/Configure/containers/StreamSettings.js index faffb1aec..315640c9d 100644 --- a/client/coral-admin/src/routes/Configure/containers/StreamSettings.js +++ b/client/coral-admin/src/routes/Configure/containers/StreamSettings.js @@ -45,7 +45,10 @@ export default compose( } `, }), - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), mapProps(({ root, settings, updatePending, errors, ...rest }) => ({ slotPassthrough: { root, diff --git a/client/coral-admin/src/routes/Configure/containers/TechSettings.js b/client/coral-admin/src/routes/Configure/containers/TechSettings.js index 7fbe81cdb..1460740ef 100644 --- a/client/coral-admin/src/routes/Configure/containers/TechSettings.js +++ b/client/coral-admin/src/routes/Configure/containers/TechSettings.js @@ -39,7 +39,10 @@ export default compose( } `, }), - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), mapProps(({ root, settings, updatePending, errors, ...rest }) => ({ slotPassthrough: { root, diff --git a/client/coral-admin/src/routes/Install/containers/Install.js b/client/coral-admin/src/routes/Install/containers/Install.js index d18f914d7..513950659 100644 --- a/client/coral-admin/src/routes/Install/containers/Install.js +++ b/client/coral-admin/src/routes/Install/containers/Install.js @@ -83,4 +83,7 @@ const mapDispatchToProps = dispatch => dispatch ); -export default connect(mapStateToProps, mapDispatchToProps)(InstallContainer); +export default connect( + mapStateToProps, + mapDispatchToProps +)(InstallContainer); diff --git a/client/coral-admin/src/routes/Moderation/components/Comment.js b/client/coral-admin/src/routes/Moderation/components/Comment.js index 97cdf9443..b12a1e616 100644 --- a/client/coral-admin/src/routes/Moderation/components/Comment.js +++ b/client/coral-admin/src/routes/Moderation/components/Comment.js @@ -170,6 +170,7 @@ class Comment extends React.Component { className={styles.external} href={`${comment.asset.url}?commentId=${comment.id}`} target="_blank" + rel="noopener noreferrer" > {t('comment.view_context')} diff --git a/client/coral-admin/src/routes/Moderation/components/StorySearch.js b/client/coral-admin/src/routes/Moderation/components/StorySearch.js index 011f49d5e..cb233c1e6 100644 --- a/client/coral-admin/src/routes/Moderation/components/StorySearch.js +++ b/client/coral-admin/src/routes/Moderation/components/StorySearch.js @@ -5,7 +5,10 @@ import { Button, Spinner, Icon } from 'coral-ui'; import Story from './Story'; const StorySearch = props => { - const { root: { assets }, data: { loading } } = props; + const { + root: { assets }, + data: { loading }, + } = props; if (!props.moderation.storySearchVisible) { return null; diff --git a/client/coral-admin/src/routes/Moderation/containers/Indicator.js b/client/coral-admin/src/routes/Moderation/containers/Indicator.js index 93ec2f40f..05bf44f5b 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Indicator.js +++ b/client/coral-admin/src/routes/Moderation/containers/Indicator.js @@ -22,7 +22,11 @@ class IndicatorContainer extends Component { document: COMMENT_ADDED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { commentAdded: comment } } } + { + subscriptionData: { + data: { commentAdded: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, @@ -31,7 +35,11 @@ class IndicatorContainer extends Component { document: COMMENT_FLAGGED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { commentFlagged: comment } } } + { + subscriptionData: { + data: { commentFlagged: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, @@ -40,7 +48,11 @@ class IndicatorContainer extends Component { document: COMMENT_EDITED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { commentEdited: comment } } } + { + subscriptionData: { + data: { commentEdited: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, @@ -49,7 +61,11 @@ class IndicatorContainer extends Component { document: COMMENT_ACCEPTED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { commentAccepted: comment } } } + { + subscriptionData: { + data: { commentAccepted: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, @@ -58,7 +74,11 @@ class IndicatorContainer extends Component { document: COMMENT_REJECTED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { commentRejected: comment } } } + { + subscriptionData: { + data: { commentRejected: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, @@ -67,7 +87,11 @@ class IndicatorContainer extends Component { document: COMMENT_RESET_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { commentReset: comment } } } + { + subscriptionData: { + data: { commentReset: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index e3f35081c..8bf5ccb79 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -71,7 +71,9 @@ class ModerationContainer extends Component { }; get activeTab() { - const { root: { asset, settings } } = this.props; + const { + root: { asset, settings }, + } = this.props; const id = getAssetId(this.props); const tab = getTab(this.props); @@ -94,7 +96,11 @@ class ModerationContainer extends Component { variables, updateQuery: ( prev, - { subscriptionData: { data: { commentAdded: comment } } } + { + subscriptionData: { + data: { commentAdded: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, @@ -104,7 +110,11 @@ class ModerationContainer extends Component { variables, updateQuery: ( prev, - { subscriptionData: { data: { commentAccepted: comment } } } + { + subscriptionData: { + data: { commentAccepted: comment }, + }, + } ) => { const user = comment.status_history[comment.status_history.length - 1] @@ -125,7 +135,11 @@ class ModerationContainer extends Component { variables, updateQuery: ( prev, - { subscriptionData: { data: { commentRejected: comment } } } + { + subscriptionData: { + data: { commentRejected: comment }, + }, + } ) => { const user = comment.status_history[comment.status_history.length - 1] @@ -146,7 +160,11 @@ class ModerationContainer extends Component { variables, updateQuery: ( prev, - { subscriptionData: { data: { commentReset: comment } } } + { + subscriptionData: { + data: { commentReset: comment }, + }, + } ) => { const user = comment.status_history[comment.status_history.length - 1] @@ -167,7 +185,11 @@ class ModerationContainer extends Component { variables, updateQuery: ( prev, - { subscriptionData: { data: { commentEdited: comment } } } + { + subscriptionData: { + data: { commentEdited: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, @@ -177,7 +199,11 @@ class ModerationContainer extends Component { variables, updateQuery: ( prev, - { subscriptionData: { data: { commentFlagged: comment } } } + { + subscriptionData: { + data: { commentFlagged: comment }, + }, + } ) => { return this.handleCommentChange(prev, comment); }, @@ -289,7 +315,11 @@ class ModerationContainer extends Component { }; render() { - const { root, root: { asset, settings }, data } = this.props; + const { + root, + root: { asset, settings }, + data, + } = this.props; const assetId = getAssetId(this.props); if (assetId) { @@ -546,7 +576,10 @@ const mapDispatchToProps = dispatch => ({ export default compose( withQueueConfig(baseQueueConfig), - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withSetCommentStatus, withModQueueQuery )(ModerationContainer); diff --git a/client/coral-admin/src/routes/Moderation/containers/StorySearch.js b/client/coral-admin/src/routes/Moderation/containers/StorySearch.js index 7f0bd639b..7b538ef6a 100644 --- a/client/coral-admin/src/routes/Moderation/containers/StorySearch.js +++ b/client/coral-admin/src/routes/Moderation/containers/StorySearch.js @@ -112,4 +112,7 @@ export const withAssetSearchQuery = withQuery( } ); -export default compose(withRouter, withAssetSearchQuery)(StorySearchContainer); +export default compose( + withRouter, + withAssetSearchQuery +)(StorySearchContainer); diff --git a/client/coral-admin/src/routes/Stories/containers/Stories.js b/client/coral-admin/src/routes/Stories/containers/Stories.js index 6c54f79d7..144076b41 100644 --- a/client/coral-admin/src/routes/Stories/containers/Stories.js +++ b/client/coral-admin/src/routes/Stories/containers/Stories.js @@ -113,4 +113,7 @@ StoriesContainer.propTypes = { updateAssetState: PropTypes.func.isRequired, }; -export default connect(mapStateToProps, mapDispatchToProps)(StoriesContainer); +export default connect( + mapStateToProps, + mapDispatchToProps +)(StoriesContainer); diff --git a/client/coral-embed-stream/src/containers/Embed.js b/client/coral-embed-stream/src/containers/Embed.js index d365af50d..836def259 100644 --- a/client/coral-embed-stream/src/containers/Embed.js +++ b/client/coral-embed-stream/src/containers/Embed.js @@ -41,7 +41,13 @@ class EmbedContainer extends React.Component { document: USER_BANNED_SUBSCRIPTION, updateQuery: ( _, - { subscriptionData: { data: { userBanned: { state } } } } + { + subscriptionData: { + data: { + userBanned: { state }, + }, + }, + } ) => { notify('info', t('your_account_has_been_banned')); props.updateStatus(state.status); @@ -51,7 +57,13 @@ class EmbedContainer extends React.Component { document: USER_SUSPENDED_SUBSCRIPTION, updateQuery: ( _, - { subscriptionData: { data: { userSuspended: { state } } } } + { + subscriptionData: { + data: { + userSuspended: { state }, + }, + }, + } ) => { notify('info', t('your_account_has_been_suspended')); props.updateStatus(state.status); @@ -61,7 +73,13 @@ class EmbedContainer extends React.Component { document: USERNAME_REJECTED_SUBSCRIPTION, updateQuery: ( _, - { subscriptionData: { data: { usernameRejected: { state } } } } + { + subscriptionData: { + data: { + usernameRejected: { state }, + }, + }, + } ) => { notify('info', t('your_username_has_been_rejected')); props.updateStatus(state.status); @@ -324,7 +342,10 @@ const mapDispatchToProps = dispatch => export default compose( withPopupAuthHandler, - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), branch(props => !props.checkedInitialLogin, renderComponent(Spinner)), withEmbedQuery )(EmbedContainer); diff --git a/client/coral-embed-stream/src/graphql/index.js b/client/coral-embed-stream/src/graphql/index.js index d9f6b4f64..e9f0b094b 100644 --- a/client/coral-embed-stream/src/graphql/index.js +++ b/client/coral-embed-stream/src/graphql/index.js @@ -126,7 +126,9 @@ export default { }, mutations: { PostComment: ({ - variables: { input: { asset_id, body, parent_id, tags = [] } }, + variables: { + input: { asset_id, body, parent_id, tags = [] }, + }, state: { auth }, }) => ({ optimisticResponse: { @@ -193,7 +195,13 @@ export default { updateQueries: { CoralEmbedStream_Embed: ( prev, - { mutationResult: { data: { createComment: { comment } } } } + { + mutationResult: { + data: { + createComment: { comment }, + }, + }, + } ) => { if ( (![ADMIN, MODERATOR].includes(prev.me.role) && @@ -208,7 +216,13 @@ export default { }, CoralEmbedStream_Profile: ( prev, - { mutationResult: { data: { createComment: { comment } } } } + { + mutationResult: { + data: { + createComment: { comment }, + }, + }, + } ) => { return update(prev, { me: { @@ -224,7 +238,13 @@ export default { updateQueries: { CoralEmbedStream_Embed: ( prev, - { mutationResult: { data: { editComment: { comment } } } } + { + mutationResult: { + data: { + editComment: { comment }, + }, + }, + } ) => { if ( !['PREMOD', 'REJECTED', 'SYSTEM_WITHHELD'].includes(comment.status) diff --git a/client/coral-embed-stream/src/tabs/configure/containers/Settings.js b/client/coral-embed-stream/src/tabs/configure/containers/Settings.js index cfb72c0ae..86e8d30b3 100644 --- a/client/coral-embed-stream/src/tabs/configure/containers/Settings.js +++ b/client/coral-embed-stream/src/tabs/configure/containers/Settings.js @@ -139,7 +139,10 @@ const mapDispatchToProps = dispatch => ); const enhance = compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withSettingsFragments, withUpdateAssetSettings, withMergedSettings('asset.settings', 'pending', 'mergedSettings') diff --git a/client/coral-embed-stream/src/tabs/profile/containers/CommentHistory.js b/client/coral-embed-stream/src/tabs/profile/containers/CommentHistory.js index 27727216e..46b188c12 100644 --- a/client/coral-embed-stream/src/tabs/profile/containers/CommentHistory.js +++ b/client/coral-embed-stream/src/tabs/profile/containers/CommentHistory.js @@ -22,7 +22,14 @@ class CommentHistoryContainer extends Component { limit: 5, cursor: this.props.root.me.comments.endCursor, }, - updateQuery: (previous, { fetchMoreResult: { me: { comments } } }) => { + updateQuery: ( + previous, + { + fetchMoreResult: { + me: { comments }, + }, + } + ) => { const updated = update(previous, { me: { comments: { @@ -97,7 +104,10 @@ const mapStateToProps = state => ({ }); export default compose( - connect(mapStateToProps, null), + connect( + mapStateToProps, + null + ), withCommentHistoryFragments, withFetchMore )(CommentHistoryContainer); diff --git a/client/coral-embed-stream/src/tabs/profile/containers/Profile.js b/client/coral-embed-stream/src/tabs/profile/containers/Profile.js index 4a84f1810..6c73e0eff 100644 --- a/client/coral-embed-stream/src/tabs/profile/containers/Profile.js +++ b/client/coral-embed-stream/src/tabs/profile/containers/Profile.js @@ -80,6 +80,7 @@ const mapStateToProps = state => ({ currentUser: state.auth.user, }); -export default compose(connect(mapStateToProps), withProfileQuery)( - ProfileContainer -); +export default compose( + connect(mapStateToProps), + withProfileQuery +)(ProfileContainer); diff --git a/client/coral-embed-stream/src/tabs/profile/containers/TabPanel.js b/client/coral-embed-stream/src/tabs/profile/containers/TabPanel.js index 46c24227f..4bbe959f7 100644 --- a/client/coral-embed-stream/src/tabs/profile/containers/TabPanel.js +++ b/client/coral-embed-stream/src/tabs/profile/containers/TabPanel.js @@ -55,7 +55,10 @@ export default compose( ${Settings.fragments.root} `, }), - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withSlotElements({ slot: 'profileSettings', propName: 'profileSettingsSlotElements', diff --git a/client/coral-embed-stream/src/tabs/stream/components/Comment.js b/client/coral-embed-stream/src/tabs/stream/components/Comment.js index 63740764f..e5aea7589 100644 --- a/client/coral-embed-stream/src/tabs/stream/components/Comment.js +++ b/client/coral-embed-stream/src/tabs/stream/components/Comment.js @@ -117,8 +117,12 @@ export default class Comment extends React.Component { } componentWillReceiveProps(next) { - const { comment: { replies: prevReplies } } = this.props; - const { comment: { replies: nextReplies } } = next; + const { + comment: { replies: prevReplies }, + } = this.props; + const { + comment: { replies: nextReplies }, + } = next; if ( prevReplies && nextReplies && @@ -243,7 +247,10 @@ export default class Comment extends React.Component { } loadNewReplies = () => { - const { comment: { replies, replyCount, id }, emit } = this.props; + const { + comment: { replies, replyCount, id }, + emit, + } = this.props; if (replyCount > replies.nodes.length) { this.setState({ loadingState: 'loading' }); this.props @@ -292,7 +299,11 @@ export default class Comment extends React.Component { // getVisibileReplies returns a list containing comments // which were authored by current user or comes before the `idCursor`. getVisibileReplies() { - const { comment: { replies }, currentUser, liveUpdates } = this.props; + const { + comment: { replies }, + currentUser, + liveUpdates, + } = this.props; const idCursor = this.state.idCursors[0]; const userId = currentUser ? currentUser.id : null; diff --git a/client/coral-embed-stream/src/tabs/stream/components/ModerationLink.js b/client/coral-embed-stream/src/tabs/stream/components/ModerationLink.js index d33f18a5e..73ec2935e 100644 --- a/client/coral-embed-stream/src/tabs/stream/components/ModerationLink.js +++ b/client/coral-embed-stream/src/tabs/stream/components/ModerationLink.js @@ -18,6 +18,7 @@ const ModerationLink = props => className="talk-embed-stream-moderation-link" href={`${BASE_PATH}admin/moderate/${props.assetId}`} target="_blank" + rel="noopener noreferrer" > {t('moderate_this_stream')} diff --git a/client/coral-embed-stream/src/tabs/stream/components/Stream.js b/client/coral-embed-stream/src/tabs/stream/components/Stream.js index 4ecb0a8bd..b097f3d57 100644 --- a/client/coral-embed-stream/src/tabs/stream/components/Stream.js +++ b/client/coral-embed-stream/src/tabs/stream/components/Stream.js @@ -211,7 +211,10 @@ class Stream extends React.Component { root, appendItemArray, asset, - asset: { comment: highlightedComment, settings: { questionBoxEnable } }, + asset: { + comment: highlightedComment, + settings: { questionBoxEnable }, + }, postComment, notify, updateItem, diff --git a/client/coral-embed-stream/src/tabs/stream/containers/CommentBox.js b/client/coral-embed-stream/src/tabs/stream/containers/CommentBox.js index 57b5a2f17..d77b72992 100644 --- a/client/coral-embed-stream/src/tabs/stream/containers/CommentBox.js +++ b/client/coral-embed-stream/src/tabs/stream/containers/CommentBox.js @@ -215,7 +215,10 @@ const mapStateToProps = state => ({ const enhance = compose( withHooks(['preSubmit', 'postSubmit']), - connect(mapStateToProps, null) + connect( + mapStateToProps, + null + ) ); export default enhance(CommentBox); diff --git a/client/coral-embed-stream/src/tabs/stream/containers/CommentNotFound.js b/client/coral-embed-stream/src/tabs/stream/containers/CommentNotFound.js index 91537aac4..963cfff0f 100644 --- a/client/coral-embed-stream/src/tabs/stream/containers/CommentNotFound.js +++ b/client/coral-embed-stream/src/tabs/stream/containers/CommentNotFound.js @@ -33,4 +33,7 @@ const mapDispatchToProps = dispatch => dispatch ); -export default connect(null, mapDispatchToProps)(CommentNotFound); +export default connect( + null, + mapDispatchToProps +)(CommentNotFound); diff --git a/client/coral-embed-stream/src/tabs/stream/containers/Stream.js b/client/coral-embed-stream/src/tabs/stream/containers/Stream.js index d6ca27558..1f32fcedf 100644 --- a/client/coral-embed-stream/src/tabs/stream/containers/Stream.js +++ b/client/coral-embed-stream/src/tabs/stream/containers/Stream.js @@ -54,7 +54,11 @@ class StreamContainer extends React.Component { }, updateQuery: ( prev, - { subscriptionData: { data: { commentEdited } } } + { + subscriptionData: { + data: { commentEdited }, + }, + } ) => { // Ignore mutations from me. // TODO: need way to detect mutations created by this client, and allow mutations from other clients. @@ -87,7 +91,14 @@ class StreamContainer extends React.Component { variables: { assetId: this.props.asset.id, }, - updateQuery: (prev, { subscriptionData: { data: { commentAdded } } }) => { + updateQuery: ( + prev, + { + subscriptionData: { + data: { commentAdded }, + }, + } + ) => { // Ignore mutations from me. // TODO: need way to detect mutations created by this client, and allow mutations from other clients. if ( @@ -488,7 +499,10 @@ const mapDispatchToProps = dispatch => export default compose( withFragments(fragments), withEmit, - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withPostComment, // `talk-plugin-flags` has a custom error handling logic. withPostFlag({ notifyOnError: false }), diff --git a/client/coral-framework/components/AdminCommentContent.js b/client/coral-framework/components/AdminCommentContent.js index b3110e822..2cbedb338 100644 --- a/client/coral-framework/components/AdminCommentContent.js +++ b/client/coral-framework/components/AdminCommentContent.js @@ -78,7 +78,12 @@ function markLinks(body, keyPrefix) { matches.forEach((match, i) => { content.push(body.substring(index, match.index)); content.push( - + {match.text} ); diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 048c4da80..75844d8ca 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -103,5 +103,8 @@ export default compose( size: props => props.size, defaultComponent: props => props.defaultComponent, }), - connect(mapStateToProps, null) + connect( + mapStateToProps, + null + ) )(Slot); diff --git a/client/coral-framework/hocs/connect.js b/client/coral-framework/hocs/connect.js index 735527fd2..2e78361eb 100644 --- a/client/coral-framework/hocs/connect.js +++ b/client/coral-framework/hocs/connect.js @@ -2,5 +2,8 @@ import { connect } from 'react-redux'; export default (mapStateToProps, ...rest) => BaseComponent => { BaseComponent.mapStateToProps = mapStateToProps; - return connect(mapStateToProps, ...rest)(BaseComponent); + return connect( + mapStateToProps, + ...rest + )(BaseComponent); }; diff --git a/client/coral-framework/hocs/withSetUsername.js b/client/coral-framework/hocs/withSetUsername.js index 3a8f65a22..f9290ef99 100644 --- a/client/coral-framework/hocs/withSetUsername.js +++ b/client/coral-framework/hocs/withSetUsername.js @@ -95,7 +95,10 @@ const mapDispatchToProps = dispatch => bindActionCreators({ updateUsername, updateStatus }, dispatch); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withSetUsernameMutation, withSetUsername ); diff --git a/client/coral-framework/hocs/withSignUp.js b/client/coral-framework/hocs/withSignUp.js index 8c35e1cc9..c2007df9a 100644 --- a/client/coral-framework/hocs/withSignUp.js +++ b/client/coral-framework/hocs/withSignUp.js @@ -121,4 +121,7 @@ const withSignUp = hoistStatics(WrappedComponent => { return WithSignUp; }); -export default compose(withSettingsQuery, withSignUp); +export default compose( + withSettingsQuery, + withSignUp +); diff --git a/client/coral-framework/hocs/withSlotElements.js b/client/coral-framework/hocs/withSlotElements.js index 9b432ade8..0373a2571 100644 --- a/client/coral-framework/hocs/withSlotElements.js +++ b/client/coral-framework/hocs/withSlotElements.js @@ -198,5 +198,11 @@ const mapStateToProps = state => ({ * })(MyComponent); */ export default settings => { - return compose(connect(mapStateToProps, null), createHOC(settings)); + return compose( + connect( + mapStateToProps, + null + ), + createHOC(settings) + ); }; diff --git a/client/coral-framework/services/events.js b/client/coral-framework/services/events.js index e0d1b1354..e1a1577a1 100644 --- a/client/coral-framework/services/events.js +++ b/client/coral-framework/services/events.js @@ -9,7 +9,11 @@ export function createReduxEmitter(eventEmitter) { // Handle apollo actions. if (action.type.startsWith('APOLLO_')) { if (action.type === 'APOLLO_SUBSCRIPTION_RESULT') { - const { operationName, variables, result: { data } } = action; + const { + operationName, + variables, + result: { data }, + } = action; eventEmitter.emit(`subscription.${operationName}.data`, { variables, data, diff --git a/config.js b/config.js index b547636f4..8987f1114 100644 --- a/config.js +++ b/config.js @@ -64,7 +64,9 @@ const CONFIG = { process.env.TALK_LOGGING_LEVEL ) ? process.env.TALK_LOGGING_LEVEL - : process.env.NODE_ENV === 'test' ? 'fatal' : 'info', + : process.env.NODE_ENV === 'test' + ? 'fatal' + : 'info', // REVISION_HASH when using the docker build will contain the build hash that // it was built at. diff --git a/graph/context.js b/graph/context.js index 9c356f0e7..ea694f6cf 100644 --- a/graph/context.js +++ b/graph/context.js @@ -149,7 +149,9 @@ class Context { * operations. */ static forSystem() { - const { models: { User } } = connectors; + const { + models: { User }, + } = connectors; // Create the system user. const user = new User({ system: true }); diff --git a/graph/errorHandler.js b/graph/errorHandler.js index 9e8d98f74..8dfd10ec3 100644 --- a/graph/errorHandler.js +++ b/graph/errorHandler.js @@ -1,7 +1,9 @@ const { forEachField } = require('./utils'); const { maskErrors } = require('graphql-errors'); const { TalkError } = require('../errors'); -const { Error: { ValidationError } } = require('mongoose'); +const { + Error: { ValidationError }, +} = require('mongoose'); // If an APIError happens in a mutation, then respond with `{errors: Array}` // according to the schema. diff --git a/graph/loaders/actions.js b/graph/loaders/actions.js index 77cc7138d..6ef29cb66 100644 --- a/graph/loaders/actions.js +++ b/graph/loaders/actions.js @@ -6,7 +6,11 @@ const { first, get, merge, remove, groupBy, reduce, isNil } = require('lodash'); * Gets actions based on their item id's. */ const genActionsByItemID = ( - { connectors: { services: { Actions } } }, + { + connectors: { + services: { Actions }, + }, + }, item_ids ) => { return Actions.findByItemIdArray(item_ids).then( @@ -21,7 +25,12 @@ const genActionsByItemID = ( * @param {Array} itemIDs the items that we need to get the actions for */ const genActionsAuthoredWithID = ( - { user = {}, connectors: { services: { Actions } } }, + { + user = {}, + connectors: { + services: { Actions }, + }, + }, itemIDs ) => Actions.getUserActions(user.id, itemIDs).then( @@ -50,7 +59,9 @@ const iterateActionCounts = action_counts => * @param {Object} item the item that we're getting the actions for */ async function getUserActions(ctx, { action_counts, id }) { - const { loaders: { Actions } } = ctx; + const { + loaders: { Actions }, + } = ctx; // Get the total count for all action types. const totalActionCount = reduce( diff --git a/graph/loaders/assets.js b/graph/loaders/assets.js index 868c8af68..0d55b6b13 100644 --- a/graph/loaders/assets.js +++ b/graph/loaders/assets.js @@ -2,7 +2,14 @@ const DataLoader = require('dataloader'); const { URL } = require('url'); const { singleJoinBy, SingletonResolver } = require('./util'); -const genAssetsByID = ({ connectors: { models: { Asset } } }, ids) => +const genAssetsByID = ( + { + connectors: { + models: { Asset }, + }, + }, + ids +) => Asset.find({ id: { $in: ids, @@ -10,7 +17,11 @@ const genAssetsByID = ({ connectors: { models: { Asset } } }, ids) => }).then(singleJoinBy(ids, 'id')); const getAssetsByQuery = async ( - { connectors: { services: { Assets } } }, + { + connectors: { + services: { Assets }, + }, + }, query ) => { // If we are requesting based on a limit, ask for one more than we want. @@ -126,7 +137,12 @@ const findOrCreateAssetByURL = async (ctx, url) => { }; const findByUrl = async ( - { connectors: { errors, services: { Assets } } }, + { + connectors: { + errors, + services: { Assets }, + }, + }, asset_url ) => { // Try to validate that the url is valid. If the URL constructor throws an diff --git a/graph/loaders/users.js b/graph/loaders/users.js index 2c1e9fbac..1a886bd25 100644 --- a/graph/loaders/users.js +++ b/graph/loaders/users.js @@ -51,7 +51,11 @@ const genUserByIDs = async (ctx, ids) => { return []; } - const { connectors: { models: { User } } } = ctx; + const { + connectors: { + models: { User }, + }, + } = ctx; return User.find({ id: { $in: ids } }).then(util.singleJoinBy(ids, 'id')); }; @@ -63,7 +67,12 @@ const genUserByIDs = async (ctx, ids) => { * @param {Object} query query terms to apply to the users query */ const getUsersByQuery = async ( - { user, connectors: { models: { User } } }, + { + user, + connectors: { + models: { User }, + }, + }, { limit, cursor, value = '', state, action_type, sortOrder } ) => { let query = User.find(); @@ -175,7 +184,12 @@ const getUsersByQuery = async ( * query */ const getCountByQuery = async ( - { user, connectors: { models: { User } } }, + { + user, + connectors: { + models: { User }, + }, + }, { action_type, state } ) => { const query = User.find(); diff --git a/graph/mutators/action.js b/graph/mutators/action.js index 5557e1a9b..62097d0cd 100644 --- a/graph/mutators/action.js +++ b/graph/mutators/action.js @@ -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 }); }; diff --git a/graph/mutators/asset.js b/graph/mutators/asset.js index d5b72102d..d87de133e 100644 --- a/graph/mutators/asset.js +++ b/graph/mutators/asset.js @@ -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); }; diff --git a/graph/mutators/comment.js b/graph/mutators/comment.js index b57aedeb3..c815dc51e 100644 --- a/graph/mutators/comment.js +++ b/graph/mutators/comment.js @@ -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. diff --git a/graph/mutators/user.js b/graph/mutators/user.js index 7422f2290..fa6a18ee5 100644 --- a/graph/mutators/user.js +++ b/graph/mutators/user.js @@ -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. diff --git a/graph/resolvers/asset.js b/graph/resolvers/asset.js index 3ed5305b7..13a950464 100644 --- a/graph/resolvers/asset.js +++ b/graph/resolvers/asset.js @@ -1,7 +1,13 @@ const { decorateWithTags, getRequestedFields } = require('./util'); const Asset = { - async comment({ id }, { id: commentId }, { loaders: { Comments } }) { + async comment( + { id }, + { id: commentId }, + { + loaders: { Comments }, + } + ) { // Load the comment from the database. const comment = await Comments.get.load(commentId); if (!comment) { @@ -15,7 +21,13 @@ const Asset = { return comment; }, - comments({ id }, { query, deep }, { loaders: { Comments } }) { + comments( + { id }, + { query, deep }, + { + loaders: { Comments }, + } + ) { if (!deep) { query.parent_id = null; } @@ -25,7 +37,13 @@ const Asset = { return Comments.getByQuery(query); }, - commentCount({ id, commentCount }, { tags }, { loaders: { Comments } }) { + commentCount( + { id, commentCount }, + { tags }, + { + loaders: { Comments }, + } + ) { if (commentCount != null) { return commentCount; } @@ -46,7 +64,9 @@ const Asset = { totalCommentCount( { id, totalCommentCount }, { tags }, - { loaders: { Comments } } + { + loaders: { Comments }, + } ) { if (totalCommentCount != null) { return totalCommentCount; @@ -64,7 +84,14 @@ const Asset = { return Comments.countByAssetID.load(id); }, - async settings({ settings = null }, _, { loaders: { Settings } }, info) { + async settings( + { settings = null }, + _, + { + loaders: { Settings }, + }, + info + ) { // Get the fields we want from the settings. const fields = getRequestedFields(info); diff --git a/graph/resolvers/comment.js b/graph/resolvers/comment.js index acd55cb1a..09d930639 100644 --- a/graph/resolvers/comment.js +++ b/graph/resolvers/comment.js @@ -16,19 +16,37 @@ const Comment = { hasParent({ parent_id }) { return !!parent_id; }, - parent({ parent_id }, _, { loaders: { Comments } }) { + parent( + { parent_id }, + _, + { + loaders: { Comments }, + } + ) { if (parent_id == null) { return null; } return Comments.get.load(parent_id); }, - user({ author_id }, _, { loaders: { Users } }) { + user( + { author_id }, + _, + { + loaders: { Users }, + } + ) { if (author_id) { return Users.getByID.load(author_id); } }, - replies({ id, asset_id, reply_count }, { query }, { loaders: { Comments } }) { + replies( + { id, asset_id, reply_count }, + { query }, + { + loaders: { Comments }, + } + ) { // Don't bother looking up replies if there aren't any there! if (reply_count === 0) { return { @@ -44,17 +62,35 @@ const Comment = { return Comments.getByQuery(query); }, replyCount: property('reply_count'), - actions({ id }, _, { loaders: { Actions } }) { + actions( + { id }, + _, + { + loaders: { Actions }, + } + ) { return Actions.getByID.load(id); }, - action_summaries(comment, _, { loaders: { Actions } }) { + action_summaries( + comment, + _, + { + loaders: { Actions }, + } + ) { if (comment.action_summaries) { return comment.action_summaries; } return Actions.getSummariesByItem.load(comment); }, - asset({ asset_id }, _, { loaders: { Assets } }) { + asset( + { asset_id }, + _, + { + loaders: { Assets }, + } + ) { return Assets.getByID.load(asset_id); }, editing: async (comment, _, { loaders: { Settings } }) => { @@ -71,7 +107,13 @@ const Comment = { editableUntil: editableUntil, }; }, - async url(comment, args, { loaders: { Assets } }) { + async url( + comment, + args, + { + loaders: { Assets }, + } + ) { const asset = await Assets.getByID.load(comment.asset_id); if (!asset) { return null; diff --git a/graph/resolvers/root_query.js b/graph/resolvers/root_query.js index 53296a2ca..e9e43f915 100644 --- a/graph/resolvers/root_query.js +++ b/graph/resolvers/root_query.js @@ -6,17 +6,36 @@ const { } = require('../../perms/constants'); const RootQuery = { - assets(_, { query }, { loaders: { Assets } }) { + assets( + _, + { query }, + { + loaders: { Assets }, + } + ) { return Assets.getByQuery(query); }, - asset(_, query, { loaders: { Assets } }) { + asset( + _, + query, + { + loaders: { Assets }, + } + ) { if (query.id) { return Assets.getByID.load(query.id); } return Assets.getByURL(query.url); }, - settings(_, args, { loaders: { Settings } }, info) { + settings( + _, + args, + { + loaders: { Settings }, + }, + info + ) { // Get the fields we want from the settings. const fields = getRequestedFields(info); @@ -26,15 +45,33 @@ const RootQuery = { // This endpoint is used for loading moderation queues, so hide it in the // event that we aren't an admin. - async comments(_, { query }, { loaders: { Comments } }) { + async comments( + _, + { query }, + { + loaders: { Comments }, + } + ) { return Comments.getByQuery(query); }, - comment(_, { id }, { loaders: { Comments } }) { + comment( + _, + { id }, + { + loaders: { Comments }, + } + ) { return Comments.get.load(id); }, - async commentCount(_, { query }, { loaders: { Comments, Assets } }) { + async commentCount( + _, + { query }, + { + loaders: { Comments, Assets }, + } + ) { const { asset_url, asset_id } = query; if ( (!asset_id || asset_id.length === 0) && @@ -50,7 +87,13 @@ const RootQuery = { return Comments.getCountByQuery(query); }, - async userCount(_, { query }, { loaders: { Users } }) { + async userCount( + _, + { query }, + { + loaders: { Users }, + } + ) { return Users.getCountByQuery(query); }, @@ -65,13 +108,25 @@ const RootQuery = { }, // this returns an arbitrary user - user(_, { id }, { loaders: { Users } }) { + user( + _, + { id }, + { + loaders: { Users }, + } + ) { return Users.getByID.load(id); }, // This endpoint is used for loading the user moderation queues (users whose username has been flagged), // so hide it in the event that we aren't an admin. - users(_, { query }, { loaders: { Users } }) { + users( + _, + { query }, + { + loaders: { Users }, + } + ) { return Users.getByQuery(query); }, }; diff --git a/graph/resolvers/settings.js b/graph/resolvers/settings.js index a299530f2..4676d9eea 100644 --- a/graph/resolvers/settings.js +++ b/graph/resolvers/settings.js @@ -5,7 +5,13 @@ const Settings = { karmaThresholds: ( settings, args, - { connectors: { services: { Karma: { THRESHOLDS } } } } + { + connectors: { + services: { + Karma: { THRESHOLDS }, + }, + }, + } ) => THRESHOLDS, }; diff --git a/graph/resolvers/user.js b/graph/resolvers/user.js index 67478785a..70e10bc4c 100644 --- a/graph/resolvers/user.js +++ b/graph/resolvers/user.js @@ -16,20 +16,44 @@ const { const { property } = require('lodash'); const User = { - action_summaries(user, _, { loaders: { Actions } }) { + action_summaries( + user, + _, + { + loaders: { Actions }, + } + ) { return Actions.getSummariesByItem.load(user); }, - actions({ id }, _, { loaders: { Actions } }) { + actions( + { id }, + _, + { + loaders: { Actions }, + } + ) { return Actions.getByID.load(id); }, - comments({ id }, { query }, { loaders: { Comments } }) { + comments( + { id }, + { query }, + { + loaders: { Comments }, + } + ) { // Set the author id on the query. query.author_id = id; return Comments.getByQuery(query); }, - ignoredUsers({ ignoresUsers }, args, { loaders: { Users } }) { + ignoredUsers( + { ignoresUsers }, + args, + { + loaders: { Users }, + } + ) { // Return nothing if there is nothing to query for. if (!ignoresUsers || ignoresUsers.length <= 0) { return []; diff --git a/plugin-api/beta/client/hocs/withReaction.js b/plugin-api/beta/client/hocs/withReaction.js index 95d3f5bcf..7181d36ec 100644 --- a/plugin-api/beta/client/hocs/withReaction.js +++ b/plugin-api/beta/client/hocs/withReaction.js @@ -413,7 +413,9 @@ export default (reaction, options = {}) => update: ( proxy, { - data: { [`create${Reaction}Action`]: { [reaction]: action } }, + data: { + [`create${Reaction}Action`]: { [reaction]: action }, + }, } ) => { const a = { @@ -466,7 +468,10 @@ export default (reaction, options = {}) => ${fragments.comment ? fragments.comment : ''} `, }), - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withDeleteReaction, withPostReaction ); diff --git a/plugin-api/beta/client/hocs/withSortOption.js b/plugin-api/beta/client/hocs/withSortOption.js index b9d556c32..f7c2bb842 100644 --- a/plugin-api/beta/client/hocs/withSortOption.js +++ b/plugin-api/beta/client/hocs/withSortOption.js @@ -52,5 +52,8 @@ export default ({ sortBy = 'created_at', sortOrder = 'DESC', label }) => ); } } - return connect(mapStateToProps, mapDispatchToProps)(WithSortOption); + return connect( + mapStateToProps, + mapDispatchToProps + )(WithSortOption); }); diff --git a/plugin-api/beta/client/hocs/withTags.js b/plugin-api/beta/client/hocs/withTags.js index 958028a4b..92d417ee3 100644 --- a/plugin-api/beta/client/hocs/withTags.js +++ b/plugin-api/beta/client/hocs/withTags.js @@ -139,7 +139,10 @@ export default (tag, options = {}) => }), withAddTag, withRemoveTag, - connect(mapStateToProps, null) + connect( + mapStateToProps, + null + ) ); WithTags.displayName = `WithTags(${getDisplayName(WrappedComponent)})`; diff --git a/plugin-api/beta/server/getReactionConfig.js b/plugin-api/beta/server/getReactionConfig.js index f1f25b261..91db0462b 100644 --- a/plugin-api/beta/server/getReactionConfig.js +++ b/plugin-api/beta/server/getReactionConfig.js @@ -180,7 +180,14 @@ function getReactionConfig(reaction) { [`${Reaction}Action`]: { // This will load the user for the specific action. We'll limit this to the // admin users only or the current logged in user. - user({ user_id }, _, { loaders: { Users }, user }) { + user( + { user_id }, + _, + { + loaders: { Users }, + user, + } + ) { if (user && (user.can(SEARCH_OTHER_USERS) || user_id === user.id)) { return Users.getByID.load(user_id); } diff --git a/plugins/talk-plugin-akismet/client/containers/CheckSpamHook.js b/plugins/talk-plugin-akismet/client/containers/CheckSpamHook.js index f580b9632..05036eed9 100644 --- a/plugins/talk-plugin-akismet/client/containers/CheckSpamHook.js +++ b/plugins/talk-plugin-akismet/client/containers/CheckSpamHook.js @@ -5,4 +5,7 @@ import CheckSpamHook from '../components/CheckSpamHook'; const mapDispatchToProps = dispatch => bindActionCreators({ notify }, dispatch); -export default connect(null, mapDispatchToProps)(CheckSpamHook); +export default connect( + null, + mapDispatchToProps +)(CheckSpamHook); diff --git a/plugins/talk-plugin-auth/client/login/containers/ForgotPassword.js b/plugins/talk-plugin-auth/client/login/containers/ForgotPassword.js index c5e2f42da..411ef1869 100644 --- a/plugins/talk-plugin-auth/client/login/containers/ForgotPassword.js +++ b/plugins/talk-plugin-auth/client/login/containers/ForgotPassword.js @@ -58,6 +58,9 @@ const mapDispatchToProps = dispatch => ); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withForgotPassword )(ForgotPasswordContainer); diff --git a/plugins/talk-plugin-auth/client/login/containers/Main.js b/plugins/talk-plugin-auth/client/login/containers/Main.js index 235bd6cde..7aaa3b759 100644 --- a/plugins/talk-plugin-auth/client/login/containers/Main.js +++ b/plugins/talk-plugin-auth/client/login/containers/Main.js @@ -50,4 +50,7 @@ const mapDispatchToProps = dispatch => dispatch ); -export default connect(mapStateToProps, mapDispatchToProps)(MainContainer); +export default connect( + mapStateToProps, + mapDispatchToProps +)(MainContainer); diff --git a/plugins/talk-plugin-auth/client/login/containers/ResendEmailConfirmation.js b/plugins/talk-plugin-auth/client/login/containers/ResendEmailConfirmation.js index 6edeb82f2..5005ded43 100644 --- a/plugins/talk-plugin-auth/client/login/containers/ResendEmailConfirmation.js +++ b/plugins/talk-plugin-auth/client/login/containers/ResendEmailConfirmation.js @@ -59,6 +59,9 @@ const mapDispatchToProps = dispatch => ); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withResendEmailConfirmation )(ResendEmailConfirmatonContainer); diff --git a/plugins/talk-plugin-auth/client/login/containers/SignIn.js b/plugins/talk-plugin-auth/client/login/containers/SignIn.js index 77c6a8614..a22e64ae7 100644 --- a/plugins/talk-plugin-auth/client/login/containers/SignIn.js +++ b/plugins/talk-plugin-auth/client/login/containers/SignIn.js @@ -89,6 +89,9 @@ const mapDispatchToProps = dispatch => ); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withSignIn )(SignInContainer); diff --git a/plugins/talk-plugin-auth/client/login/containers/SignUp.js b/plugins/talk-plugin-auth/client/login/containers/SignUp.js index f7fc6f2d2..d908c42d3 100644 --- a/plugins/talk-plugin-auth/client/login/containers/SignUp.js +++ b/plugins/talk-plugin-auth/client/login/containers/SignUp.js @@ -145,6 +145,9 @@ const mapDispatchToProps = dispatch => ); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withSignUp )(SignUpContainer); diff --git a/plugins/talk-plugin-auth/client/stream/containers/SetUsernameDialog.js b/plugins/talk-plugin-auth/client/stream/containers/SetUsernameDialog.js index 93c7ea74b..62f4abc39 100644 --- a/plugins/talk-plugin-auth/client/stream/containers/SetUsernameDialog.js +++ b/plugins/talk-plugin-auth/client/stream/containers/SetUsernameDialog.js @@ -58,7 +58,10 @@ const mapStateToProps = state => ({ }); export default compose( - connect(mapStateToProps, null), + connect( + mapStateToProps, + null + ), withSetUsername, branch(props => !props.username, renderNothing) )(SetUsernameDialogContainer); diff --git a/plugins/talk-plugin-auth/client/stream/containers/SignInButton.js b/plugins/talk-plugin-auth/client/stream/containers/SignInButton.js index 87b2a900f..181e93d32 100644 --- a/plugins/talk-plugin-auth/client/stream/containers/SignInButton.js +++ b/plugins/talk-plugin-auth/client/stream/containers/SignInButton.js @@ -11,4 +11,7 @@ const mapStateToProps = state => ({ const mapDispatchToProps = dispatch => bindActionCreators({ showSignInDialog }, dispatch); -export default connect(mapStateToProps, mapDispatchToProps)(SignInButton); +export default connect( + mapStateToProps, + mapDispatchToProps +)(SignInButton); diff --git a/plugins/talk-plugin-auth/client/stream/containers/UserBox.js b/plugins/talk-plugin-auth/client/stream/containers/UserBox.js index 720a61087..2743a1e70 100644 --- a/plugins/talk-plugin-auth/client/stream/containers/UserBox.js +++ b/plugins/talk-plugin-auth/client/stream/containers/UserBox.js @@ -10,4 +10,7 @@ const mapStateToProps = state => ({ const mapDispatchToProps = dispatch => bindActionCreators({ logout }, dispatch); -export default connect(mapStateToProps, mapDispatchToProps)(UserBox); +export default connect( + mapStateToProps, + mapDispatchToProps +)(UserBox); diff --git a/plugins/talk-plugin-author-menu/client/containers/AuthorName.js b/plugins/talk-plugin-author-menu/client/containers/AuthorName.js index e385058c4..83a897ab6 100644 --- a/plugins/talk-plugin-author-menu/client/containers/AuthorName.js +++ b/plugins/talk-plugin-author-menu/client/containers/AuthorName.js @@ -122,7 +122,10 @@ const withAuthorNameFragments = withFragments({ }); const enhance = compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withAuthorNameFragments ); diff --git a/plugins/talk-plugin-deep-reply-count/index.js b/plugins/talk-plugin-deep-reply-count/index.js index 4c06329a7..1f02d30e0 100644 --- a/plugins/talk-plugin-deep-reply-count/index.js +++ b/plugins/talk-plugin-deep-reply-count/index.js @@ -85,7 +85,13 @@ module.exports = { }), resolvers: { Comment: { - deepReplyCount({ id }, args, { loaders: { Comments } }) { + deepReplyCount( + { id }, + args, + { + loaders: { Comments }, + } + ) { return Comments.getDeepCount.load(id); }, }, diff --git a/plugins/talk-plugin-facebook-auth/client/containers/FacebookButton.js b/plugins/talk-plugin-facebook-auth/client/containers/FacebookButton.js index 8ae3ff01e..348c6cb61 100644 --- a/plugins/talk-plugin-facebook-auth/client/containers/FacebookButton.js +++ b/plugins/talk-plugin-facebook-auth/client/containers/FacebookButton.js @@ -6,4 +6,7 @@ import FacebookButton from '../components/FacebookButton'; const mapDispatchToProps = dispatch => bindActionCreators({ onClick: loginWithFacebook }, dispatch); -export default connect(null, mapDispatchToProps)(FacebookButton); +export default connect( + null, + mapDispatchToProps +)(FacebookButton); diff --git a/plugins/talk-plugin-facebook-auth/server/router.js b/plugins/talk-plugin-facebook-auth/server/router.js index 10d2469da..4d72237d2 100644 --- a/plugins/talk-plugin-facebook-auth/server/router.js +++ b/plugins/talk-plugin-facebook-auth/server/router.js @@ -5,7 +5,11 @@ module.exports = router => { */ router.get('/api/v1/auth/facebook', (req, res, next) => { const { - connectors: { services: { Passport: { passport } } }, + connectors: { + services: { + Passport: { passport }, + }, + }, } = req.context; return passport.authenticate('facebook', { @@ -22,7 +26,9 @@ module.exports = router => { router.get('/api/v1/auth/facebook/callback', (req, res, next) => { const { connectors: { - services: { Passport: { passport, HandleAuthPopupCallback } }, + services: { + Passport: { passport, HandleAuthPopupCallback }, + }, }, } = req.context; diff --git a/plugins/talk-plugin-featured-comments/client/containers/FeaturedDialog.js b/plugins/talk-plugin-featured-comments/client/containers/FeaturedDialog.js index c3ad0a96d..b988f1a6c 100644 --- a/plugins/talk-plugin-featured-comments/client/containers/FeaturedDialog.js +++ b/plugins/talk-plugin-featured-comments/client/containers/FeaturedDialog.js @@ -19,7 +19,10 @@ const mapDispatchToProps = dispatch => ); const enhance = compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withTags('featured') ); diff --git a/plugins/talk-plugin-featured-comments/client/containers/ModActionButton.js b/plugins/talk-plugin-featured-comments/client/containers/ModActionButton.js index 7c8f94fb3..b5302c73d 100644 --- a/plugins/talk-plugin-featured-comments/client/containers/ModActionButton.js +++ b/plugins/talk-plugin-featured-comments/client/containers/ModActionButton.js @@ -13,7 +13,10 @@ const mapDispatchToProps = dispatch => ); const enhance = compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withTags('featured') ); diff --git a/plugins/talk-plugin-featured-comments/client/containers/ModIndicatorSubscription.js b/plugins/talk-plugin-featured-comments/client/containers/ModIndicatorSubscription.js index a8153b49e..5780459dd 100644 --- a/plugins/talk-plugin-featured-comments/client/containers/ModIndicatorSubscription.js +++ b/plugins/talk-plugin-featured-comments/client/containers/ModIndicatorSubscription.js @@ -12,7 +12,13 @@ class ModIndicatorSubscription extends React.Component { document: COMMENT_FEATURED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { commentFeatured: { comment } } } } + { + subscriptionData: { + data: { + commentFeatured: { comment }, + }, + }, + } ) => { return this.props.handleCommentChange(prev, comment); }, @@ -21,7 +27,13 @@ class ModIndicatorSubscription extends React.Component { document: COMMENT_UNFEATURED_SUBSCRIPTION, updateQuery: ( prev, - { subscriptionData: { data: { commentUnfeatured: { comment } } } } + { + subscriptionData: { + data: { + commentUnfeatured: { comment }, + }, + }, + } ) => { return this.props.handleCommentChange(prev, comment); }, diff --git a/plugins/talk-plugin-featured-comments/client/containers/ModSubscription.js b/plugins/talk-plugin-featured-comments/client/containers/ModSubscription.js index d91d69304..fa7d95ba6 100644 --- a/plugins/talk-plugin-featured-comments/client/containers/ModSubscription.js +++ b/plugins/talk-plugin-featured-comments/client/containers/ModSubscription.js @@ -28,7 +28,13 @@ class ModSubscription extends React.Component { }, updateQuery: ( prev, - { subscriptionData: { data: { commentFeatured: { user, comment } } } } + { + subscriptionData: { + data: { + commentFeatured: { user, comment }, + }, + }, + } ) => { const notifyText = this.props.user.id === user.id @@ -50,7 +56,9 @@ class ModSubscription extends React.Component { prev, { subscriptionData: { - data: { commentUnfeatured: { user, comment } }, + data: { + commentUnfeatured: { user, comment }, + }, }, } ) => { @@ -117,7 +125,10 @@ const mapStateToProps = state => ({ }); export default compose( - connect(mapStateToProps, null), + connect( + mapStateToProps, + null + ), withVariables, withSubscribeToMore )(ModSubscription); diff --git a/plugins/talk-plugin-featured-comments/client/containers/ModTag.js b/plugins/talk-plugin-featured-comments/client/containers/ModTag.js index 42c653418..72a035ff4 100644 --- a/plugins/talk-plugin-featured-comments/client/containers/ModTag.js +++ b/plugins/talk-plugin-featured-comments/client/containers/ModTag.js @@ -22,7 +22,10 @@ const fragments = { `, }; const enhance = compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withTags('featured', { fragments }) ); diff --git a/plugins/talk-plugin-featured-comments/client/containers/TabPane.js b/plugins/talk-plugin-featured-comments/client/containers/TabPane.js index b3f44b429..59caa9af9 100644 --- a/plugins/talk-plugin-featured-comments/client/containers/TabPane.js +++ b/plugins/talk-plugin-featured-comments/client/containers/TabPane.js @@ -90,7 +90,10 @@ const mapDispatchToProps = dispatch => ); const enhance = compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withFetchMore, withVariables, withFragments({ diff --git a/plugins/talk-plugin-featured-comments/index.js b/plugins/talk-plugin-featured-comments/index.js index 6dd3114e1..27deb9c05 100644 --- a/plugins/talk-plugin-featured-comments/index.js +++ b/plugins/talk-plugin-featured-comments/index.js @@ -59,8 +59,14 @@ module.exports = { addTag: { async post( obj, - { tag: { name, id, item_type } }, - { user, mutators: { Comment }, pubsub } + { + tag: { name, id, item_type }, + }, + { + user, + mutators: { Comment }, + pubsub, + } ) { if (name === 'FEATURED' && item_type === 'COMMENTS') { const comment = await Comment.setStatus({ @@ -76,8 +82,14 @@ module.exports = { removeTag: { async post( obj, - { tag: { name, id, item_type } }, - { user, loaders: { Comments }, pubsub } + { + tag: { name, id, item_type }, + }, + { + user, + loaders: { Comments }, + pubsub, + } ) { if (name === 'FEATURED' && item_type === 'COMMENTS') { const comment = await Comments.get.load(id); diff --git a/plugins/talk-plugin-flag-details/client/components/FlagDetails.js b/plugins/talk-plugin-flag-details/client/components/FlagDetails.js index 7900f5b50..75871fb57 100644 --- a/plugins/talk-plugin-flag-details/client/components/FlagDetails.js +++ b/plugins/talk-plugin-flag-details/client/components/FlagDetails.js @@ -10,7 +10,12 @@ import { class FlagDetails extends Component { render() { - const { comment: { actions }, more, root, comment } = this.props; + const { + comment: { actions }, + more, + root, + comment, + } = this.props; const flagActions = actions && actions.filter(a => a.__typename === 'FlagAction'); diff --git a/plugins/talk-plugin-flag-details/client/components/UserFlagDetails.js b/plugins/talk-plugin-flag-details/client/components/UserFlagDetails.js index 30f83ad9d..9b9982882 100644 --- a/plugins/talk-plugin-flag-details/client/components/UserFlagDetails.js +++ b/plugins/talk-plugin-flag-details/client/components/UserFlagDetails.js @@ -5,7 +5,10 @@ import styles from './UserFlagDetails.css'; class UserFlagDetails extends Component { render() { - const { comment: { actions }, viewUserDetail } = this.props; + const { + comment: { actions }, + viewUserDetail, + } = this.props; const flagActions = actions && actions.filter(a => a.__typename === 'FlagAction'); diff --git a/plugins/talk-plugin-flag-details/client/containers/UserFlagDetails.js b/plugins/talk-plugin-flag-details/client/containers/UserFlagDetails.js index 7dd867456..c52f15192 100644 --- a/plugins/talk-plugin-flag-details/client/containers/UserFlagDetails.js +++ b/plugins/talk-plugin-flag-details/client/containers/UserFlagDetails.js @@ -15,7 +15,10 @@ const mapDispatchToProps = dispatch => ({ }); const enhance = compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withFragments({ comment: gql` fragment CoralAdmin_UserFlagDetails_comment on Comment { diff --git a/plugins/talk-plugin-google-auth/client/containers/GoogleButton.js b/plugins/talk-plugin-google-auth/client/containers/GoogleButton.js index d1982e351..390f1a722 100644 --- a/plugins/talk-plugin-google-auth/client/containers/GoogleButton.js +++ b/plugins/talk-plugin-google-auth/client/containers/GoogleButton.js @@ -6,4 +6,7 @@ import GoogleButton from '../components/GoogleButton'; const mapDispatchToProps = dispatch => bindActionCreators({ onClick: loginWithGoogle }, dispatch); -export default connect(null, mapDispatchToProps)(GoogleButton); +export default connect( + null, + mapDispatchToProps +)(GoogleButton); diff --git a/plugins/talk-plugin-ignore-user/client/containers/IgnoreUserAction.js b/plugins/talk-plugin-ignore-user/client/containers/IgnoreUserAction.js index 033be6ed6..b76ba8c3f 100644 --- a/plugins/talk-plugin-ignore-user/client/containers/IgnoreUserAction.js +++ b/plugins/talk-plugin-ignore-user/client/containers/IgnoreUserAction.js @@ -45,7 +45,10 @@ const withIgnoreUserActionFragments = withFragments({ }); const enhance = compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withIgnoreUserActionFragments, excludeIf(({ root: { me }, comment }) => !me || me.id === comment.user.id) ); diff --git a/plugins/talk-plugin-ignore-user/client/containers/IgnoreUserConfirmation.js b/plugins/talk-plugin-ignore-user/client/containers/IgnoreUserConfirmation.js index efd4cd366..a4d39e4df 100644 --- a/plugins/talk-plugin-ignore-user/client/containers/IgnoreUserConfirmation.js +++ b/plugins/talk-plugin-ignore-user/client/containers/IgnoreUserConfirmation.js @@ -65,7 +65,10 @@ const withIgnoreUserConfirmationFragments = withFragments({ }); const enhance = compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withIgnoreUserConfirmationFragments, withIgnoreUser ); diff --git a/plugins/talk-plugin-ignore-user/client/containers/IgnoredUserSection.js b/plugins/talk-plugin-ignore-user/client/containers/IgnoredUserSection.js index 36bb477c4..91075f20a 100644 --- a/plugins/talk-plugin-ignore-user/client/containers/IgnoredUserSection.js +++ b/plugins/talk-plugin-ignore-user/client/containers/IgnoredUserSection.js @@ -37,6 +37,9 @@ const withIgnoredUserSectionFragments = withFragments({ `, }); -const enhance = compose(withIgnoredUserSectionFragments, withStopIgnoringUser); +const enhance = compose( + withIgnoredUserSectionFragments, + withStopIgnoringUser +); export default enhance(IgnoredUserSectionContainer); diff --git a/plugins/talk-plugin-local-auth/client/components/AddEmailAddressDialog.js b/plugins/talk-plugin-local-auth/client/components/AddEmailAddressDialog.js index a5bfd7096..00912fdfd 100644 --- a/plugins/talk-plugin-local-auth/client/components/AddEmailAddressDialog.js +++ b/plugins/talk-plugin-local-auth/client/components/AddEmailAddressDialog.js @@ -142,7 +142,9 @@ class AddEmailAddressDialog extends React.Component { render() { const { errors, formData, showErrors, step } = this.state; - const { root: { settings } } = this.props; + const { + root: { settings }, + } = this.props; return ( diff --git a/plugins/talk-plugin-local-auth/client/components/ChangePassword.js b/plugins/talk-plugin-local-auth/client/components/ChangePassword.js index cae112203..1434543bf 100644 --- a/plugins/talk-plugin-local-auth/client/components/ChangePassword.js +++ b/plugins/talk-plugin-local-auth/client/components/ChangePassword.js @@ -135,7 +135,11 @@ class ChangePassword extends React.Component { }; onForgotPassword = async () => { - const { root: { me: { email } } } = this.props; + const { + root: { + me: { email }, + }, + } = this.props; try { await this.props.forgotPassword(email); diff --git a/plugins/talk-plugin-local-auth/client/components/Profile.js b/plugins/talk-plugin-local-auth/client/components/Profile.js index caa09543b..139949b99 100644 --- a/plugins/talk-plugin-local-auth/client/components/Profile.js +++ b/plugins/talk-plugin-local-auth/client/components/Profile.js @@ -114,7 +114,11 @@ class Profile extends React.Component { isSaveEnabled = () => { const { formData } = this.state; - const { root: { me: { username, email } } } = this.props; + const { + root: { + me: { username, email }, + }, + } = this.props; const formHasErrors = !!Object.keys(this.state.errors).length; const validUsername = formData.newUsername && formData.newUsername !== username; @@ -166,7 +170,13 @@ class Profile extends React.Component { render() { const { - root: { me: { username, email, state: { status } } }, + root: { + me: { + username, + email, + state: { status }, + }, + }, notify, } = this.props; const { editing, formData, showDialog } = this.state; diff --git a/plugins/talk-plugin-local-auth/client/containers/AddEmailAddressDialog.js b/plugins/talk-plugin-local-auth/client/containers/AddEmailAddressDialog.js index f6de3b39c..695acb8c9 100644 --- a/plugins/talk-plugin-local-auth/client/containers/AddEmailAddressDialog.js +++ b/plugins/talk-plugin-local-auth/client/containers/AddEmailAddressDialog.js @@ -36,7 +36,10 @@ const withData = withFragments({ }); export default compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withAttachLocalAuth, withData, excludeIf( diff --git a/plugins/talk-plugin-local-auth/client/containers/ChangePassword.js b/plugins/talk-plugin-local-auth/client/containers/ChangePassword.js index 11bd5c5fb..3c3d5025e 100644 --- a/plugins/talk-plugin-local-auth/client/containers/ChangePassword.js +++ b/plugins/talk-plugin-local-auth/client/containers/ChangePassword.js @@ -21,7 +21,10 @@ const withData = withFragments({ }); export default compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withChangePassword, withForgotPassword, withData diff --git a/plugins/talk-plugin-local-auth/client/containers/Profile.js b/plugins/talk-plugin-local-auth/client/containers/Profile.js index ccfca72ae..d86d8cc9d 100644 --- a/plugins/talk-plugin-local-auth/client/containers/Profile.js +++ b/plugins/talk-plugin-local-auth/client/containers/Profile.js @@ -32,7 +32,10 @@ const withData = withFragments({ }); export default compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withSetUsername, withUpdateEmailAddress, withData diff --git a/plugins/talk-plugin-local-auth/server/mutators.js b/plugins/talk-plugin-local-auth/server/mutators.js index 7049cd546..044371688 100644 --- a/plugins/talk-plugin-local-auth/server/mutators.js +++ b/plugins/talk-plugin-local-auth/server/mutators.js @@ -18,7 +18,10 @@ async function updateUserEmailAddress(ctx, email, confirmPassword) { const { user, loaders: { Settings }, - connectors: { models: { User }, services: { Mailer, I18n, Users } }, + connectors: { + models: { User }, + services: { Mailer, I18n, Users }, + }, } = ctx; // Ensure that the user has a local profile associated with their account. @@ -27,7 +30,7 @@ async function updateUserEmailAddress(ctx, email, confirmPassword) { } // Ensure that the password provided matches what we have on file. - if (!await user.verifyPassword(confirmPassword)) { + if (!(await user.verifyPassword(confirmPassword))) { throw new ErrIncorrectPassword(); } @@ -81,7 +84,13 @@ async function updateUserEmailAddress(ctx, email, confirmPassword) { // attachUserLocalAuth will attach a new local profile to an existing user. async function attachUserLocalAuth(ctx, email, password) { - const { user, connectors: { models: { User }, services: { Users } } } = ctx; + const { + user, + connectors: { + models: { User }, + services: { Users }, + }, + } = ctx; // Ensure that the current user doesn't already have a local account // associated with them. diff --git a/plugins/talk-plugin-moderation-actions/client/containers/BanUserAction.js b/plugins/talk-plugin-moderation-actions/client/containers/BanUserAction.js index c5fdb1e32..e91f4dabc 100644 --- a/plugins/talk-plugin-moderation-actions/client/containers/BanUserAction.js +++ b/plugins/talk-plugin-moderation-actions/client/containers/BanUserAction.js @@ -15,7 +15,10 @@ class BanUserActionContainer extends React.Component { }; render() { - const { root: { me }, comment } = this.props; + const { + root: { me }, + comment, + } = this.props; return me.id !== comment.user.id ? ( ) : null; @@ -30,6 +33,11 @@ const mapDispatchToProps = dispatch => dispatch ); -const enhance = compose(connect(null, mapDispatchToProps)); +const enhance = compose( + connect( + null, + mapDispatchToProps + ) +); export default enhance(BanUserActionContainer); diff --git a/plugins/talk-plugin-moderation-actions/client/containers/BanUserDialog.js b/plugins/talk-plugin-moderation-actions/client/containers/BanUserDialog.js index 8dd3cce7d..bb7dc590b 100644 --- a/plugins/talk-plugin-moderation-actions/client/containers/BanUserDialog.js +++ b/plugins/talk-plugin-moderation-actions/client/containers/BanUserDialog.js @@ -70,7 +70,10 @@ const mapDispatchToProps = dispatch => ); const enhance = compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withSetCommentStatus, withBanUser ); diff --git a/plugins/talk-plugin-moderation-actions/client/containers/ModerationActions.js b/plugins/talk-plugin-moderation-actions/client/containers/ModerationActions.js index 891d248ce..f365a8a80 100644 --- a/plugins/talk-plugin-moderation-actions/client/containers/ModerationActions.js +++ b/plugins/talk-plugin-moderation-actions/client/containers/ModerationActions.js @@ -68,7 +68,10 @@ const mapDispatchToProps = dispatch => ); const enhance = compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withFragments({ root: gql` fragment TalkModerationActions_root on RootQuery { diff --git a/plugins/talk-plugin-notifications/client/api/hocs/withSettingsToggle.js b/plugins/talk-plugin-notifications/client/api/hocs/withSettingsToggle.js index fc7b1bac6..95306da99 100644 --- a/plugins/talk-plugin-notifications/client/api/hocs/withSettingsToggle.js +++ b/plugins/talk-plugin-notifications/client/api/hocs/withSettingsToggle.js @@ -73,7 +73,11 @@ const withSettingsToggle = settingsName => { mutations: { UpdateNotificationSettings: ({ variables: { input }, - state: { auth: { user: { id } } }, + state: { + auth: { + user: { id }, + }, + }, }) => ({ update: proxy => { if (input[settingsName] === undefined) { diff --git a/plugins/talk-plugin-notifications/client/graphql.js b/plugins/talk-plugin-notifications/client/graphql.js index e99bc6a83..3759ac99e 100644 --- a/plugins/talk-plugin-notifications/client/graphql.js +++ b/plugins/talk-plugin-notifications/client/graphql.js @@ -13,7 +13,11 @@ export default { mutations: { UpdateNotificationSettings: ({ variables: { input }, - state: { auth: { user: { id } } }, + state: { + auth: { + user: { id }, + }, + }, }) => ({ optimisticResponse: { updateNotificationSettings: { diff --git a/plugins/talk-plugin-notifications/server/NotificationManager.js b/plugins/talk-plugin-notifications/server/NotificationManager.js index 63af8efdb..03358ed42 100644 --- a/plugins/talk-plugin-notifications/server/NotificationManager.js +++ b/plugins/talk-plugin-notifications/server/NotificationManager.js @@ -116,7 +116,12 @@ class NotificationManager { try { // Pull out some useful tools. const { - connectors: { models: { User }, services: { I18n: { t } } }, + connectors: { + models: { User }, + services: { + I18n: { t }, + }, + }, } = ctx; const organizationName = await getOrganizationName(ctx); diff --git a/plugins/talk-plugin-notifications/server/connect.js b/plugins/talk-plugin-notifications/server/connect.js index 86ed81871..26c5637e9 100644 --- a/plugins/talk-plugin-notifications/server/connect.js +++ b/plugins/talk-plugin-notifications/server/connect.js @@ -6,7 +6,10 @@ const { map, reduce } = require('lodash'); module.exports = connectors => { const { - graph: { subscriptions: { getBroker }, Context }, + graph: { + subscriptions: { getBroker }, + Context, + }, services: { Mailer, Plugins }, } = connectors; diff --git a/plugins/talk-plugin-notifications/server/messages.js b/plugins/talk-plugin-notifications/server/messages.js index 0ba9ee70b..fc7b159ea 100644 --- a/plugins/talk-plugin-notifications/server/messages.js +++ b/plugins/talk-plugin-notifications/server/messages.js @@ -37,7 +37,11 @@ const queueNotifications = async (ctx, userID, notifications) => { ); // Pull out some useful tools. - const { connectors: { models: { User } } } = ctx; + const { + connectors: { + models: { User }, + }, + } = ctx; ctx.log.info( { notifications: notifications.length, userID }, @@ -67,7 +71,13 @@ const sendNotificationsBatch = async (ctx, notifications) => { map( notifications, async ({ handler, notification: { userID, context } }) => { - const { connectors: { services: { I18n: { t } } } } = ctx; + const { + connectors: { + services: { + I18n: { t }, + }, + }, + } = ctx; const { category } = handler; // Compose the subject for the email. @@ -181,7 +191,9 @@ const USER_CONFIRMATION_QUERY = ` // returns undefined. const filterVerifiedNotification = ctx => async notification => { // Grab the user that we're supposed to be sending the notification to. - const { notification: { userID } } = notification; + const { + notification: { userID }, + } = notification; // Check their confirmed status. This should have already been hit by the // loaders, so we shouldn't make any more database requests. diff --git a/plugins/talk-plugin-notifications/server/mutators.js b/plugins/talk-plugin-notifications/server/mutators.js index 46954faa5..f35fe21e4 100644 --- a/plugins/talk-plugin-notifications/server/mutators.js +++ b/plugins/talk-plugin-notifications/server/mutators.js @@ -15,7 +15,12 @@ function reduceSettings(newSettings, newValue, key) { * Update the user notification settings. */ async function updateNotificationSettings(ctx, settings) { - const { connectors: { models: { User } }, user } = ctx; + const { + connectors: { + models: { User }, + }, + user, + } = ctx; // Generate the settings set object, and just exit if we haven't changed // anything. @@ -29,7 +34,9 @@ async function updateNotificationSettings(ctx, settings) { } module.exports = ctx => { - const { connectors: { errors: ErrNotAuthorized } } = ctx; + const { + connectors: { errors: ErrNotAuthorized }, + } = ctx; let mutators = { User: { diff --git a/plugins/talk-plugin-notifications/server/resolvers.js b/plugins/talk-plugin-notifications/server/resolvers.js index 58fd8b3e4..0ea33c0ac 100644 --- a/plugins/talk-plugin-notifications/server/resolvers.js +++ b/plugins/talk-plugin-notifications/server/resolvers.js @@ -16,7 +16,13 @@ module.exports = { digestFrequency: settings => get(settings, 'digestFrequency', 'NONE'), }, RootMutation: { - async updateNotificationSettings(obj, { input }, { mutators: { User } }) { + async updateNotificationSettings( + obj, + { input }, + { + mutators: { User }, + } + ) { await User.updateNotificationSettings(input); }, }, diff --git a/plugins/talk-plugin-notifications/server/router.js b/plugins/talk-plugin-notifications/server/router.js index 9185c5aba..dd2a916a0 100644 --- a/plugins/talk-plugin-notifications/server/router.js +++ b/plugins/talk-plugin-notifications/server/router.js @@ -12,7 +12,10 @@ module.exports = router => { */ const verifyToken = (req, res, next) => { const { - connectors: { secrets: { jwt }, config: { JWT_ISSUER, JWT_AUDIENCE } }, + connectors: { + secrets: { jwt }, + config: { JWT_ISSUER, JWT_AUDIENCE }, + }, } = req.context; const { token: tokenString = '' } = req.body; if (!tokenString) { @@ -50,7 +53,11 @@ module.exports = router => { '/api/v1/account/unsubscribe-notifications', verifyToken, async (req, res, next) => { - const { connectors: { models: { User } } } = req.context; + const { + connectors: { + models: { User }, + }, + } = req.context; const { user: userID } = req.token; try { diff --git a/plugins/talk-plugin-notifications/server/util.js b/plugins/talk-plugin-notifications/server/util.js index bbebef4b2..31a2034b5 100644 --- a/plugins/talk-plugin-notifications/server/util.js +++ b/plugins/talk-plugin-notifications/server/util.js @@ -1,6 +1,8 @@ const getOrganizationName = async ctx => { // Grab some useful tools. - const { loaders: { Settings } } = ctx; + const { + loaders: { Settings }, + } = ctx; // Get the settings. const { organizationName = null } = await Settings.select('organizationName'); @@ -16,7 +18,13 @@ const getOrganizationName = async ctx => { * @param {Mixed} context the notification context */ const getNotificationBody = async (ctx, handler, context) => { - const { connectors: { services: { I18n: { t } } } } = ctx; + const { + connectors: { + services: { + I18n: { t }, + }, + }, + } = ctx; const { category, hydrate = () => [] } = handler; // Get the body replacement variables for the translation key. diff --git a/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js b/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js index b63cfb13e..9a4870b0b 100644 --- a/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js +++ b/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js @@ -23,4 +23,7 @@ const mapDispatchToProps = dispatch => dispatch ); -export default connect(mapStateToProps, mapDispatchToProps)(OffTopicFilter); +export default connect( + mapStateToProps, + mapDispatchToProps +)(OffTopicFilter); diff --git a/plugins/talk-plugin-profile-data/client/components/AccountDeletionRequestedSign.js b/plugins/talk-plugin-profile-data/client/components/AccountDeletionRequestedSign.js index f0e7be8f3..1728e8ff9 100644 --- a/plugins/talk-plugin-profile-data/client/components/AccountDeletionRequestedSign.js +++ b/plugins/talk-plugin-profile-data/client/components/AccountDeletionRequestedSign.js @@ -20,7 +20,9 @@ class AccountDeletionRequestedSign extends React.Component { }; render() { - const { me: { scheduledDeletionDate } } = this.props.root; + const { + me: { scheduledDeletionDate }, + } = this.props.root; const deletionScheduledFor = moment(scheduledDeletionDate).format( 'MMM Do YYYY, h:mm a' diff --git a/plugins/talk-plugin-profile-data/client/components/DownloadCommentHistory.js b/plugins/talk-plugin-profile-data/client/components/DownloadCommentHistory.js index 7af15b774..17aa10264 100644 --- a/plugins/talk-plugin-profile-data/client/components/DownloadCommentHistory.js +++ b/plugins/talk-plugin-profile-data/client/components/DownloadCommentHistory.js @@ -36,7 +36,11 @@ class DownloadCommentHistory extends Component { }; render() { - const { root: { me: { lastAccountDownload } } } = this.props; + const { + root: { + me: { lastAccountDownload }, + }, + } = this.props; const now = new Date(); const lastAccountDownloadDate = diff --git a/plugins/talk-plugin-profile-data/client/containers/AccountDeletionRequestedSign.js b/plugins/talk-plugin-profile-data/client/containers/AccountDeletionRequestedSign.js index ff54198dd..4b3c830e1 100644 --- a/plugins/talk-plugin-profile-data/client/containers/AccountDeletionRequestedSign.js +++ b/plugins/talk-plugin-profile-data/client/containers/AccountDeletionRequestedSign.js @@ -18,7 +18,10 @@ const withData = withFragments({ }); export default compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withCancelAccountDeletion, withData, excludeIf(({ root: { me } }) => !me || !me.scheduledDeletionDate) diff --git a/plugins/talk-plugin-profile-data/client/containers/DeleteMyAccount.js b/plugins/talk-plugin-profile-data/client/containers/DeleteMyAccount.js index ac244d8b8..8e655c298 100644 --- a/plugins/talk-plugin-profile-data/client/containers/DeleteMyAccount.js +++ b/plugins/talk-plugin-profile-data/client/containers/DeleteMyAccount.js @@ -21,7 +21,10 @@ const withData = withFragments({ }); export default compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withRequestAccountDeletion, withCancelAccountDeletion, withData diff --git a/plugins/talk-plugin-profile-data/client/containers/DownloadCommentHistory.js b/plugins/talk-plugin-profile-data/client/containers/DownloadCommentHistory.js index 1716de983..7d91164d4 100644 --- a/plugins/talk-plugin-profile-data/client/containers/DownloadCommentHistory.js +++ b/plugins/talk-plugin-profile-data/client/containers/DownloadCommentHistory.js @@ -28,7 +28,10 @@ class DownloadCommentHistoryContainer extends Component { const mapDispatchToProps = dispatch => bindActionCreators({ notify }, dispatch); const enhance = compose( - connect(null, mapDispatchToProps), + connect( + null, + mapDispatchToProps + ), withFragments({ root: gql` fragment TalkDownloadCommentHistory_DownloadCommentHistorySection_root on RootQuery { diff --git a/plugins/talk-plugin-profile-data/server/connect.js b/plugins/talk-plugin-profile-data/server/connect.js index 676d67176..60fe0eabb 100644 --- a/plugins/talk-plugin-profile-data/server/connect.js +++ b/plugins/talk-plugin-profile-data/server/connect.js @@ -32,7 +32,9 @@ module.exports = connectors => { try { // Grab some settings. - const { loaders: { Settings } } = ctx; + const { + loaders: { Settings }, + } = ctx; const { organizationName, organizationContactEmail, diff --git a/plugins/talk-plugin-profile-data/server/mutators.js b/plugins/talk-plugin-profile-data/server/mutators.js index 4a1e97791..07cf9a492 100644 --- a/plugins/talk-plugin-profile-data/server/mutators.js +++ b/plugins/talk-plugin-profile-data/server/mutators.js @@ -16,7 +16,12 @@ const { // generateDownloadLinks will generate a signed set of links for a given user to // download an archive of their data. async function generateDownloadLinks(ctx, userID) { - const { connectors: { url: { BASE_URL }, secrets } } = ctx; + const { + connectors: { + url: { BASE_URL }, + secrets, + }, + } = ctx; // Generate a token for the download link. const token = await secrets.jwt.sign( @@ -42,7 +47,10 @@ async function sendDownloadLink(ctx) { const { user, loaders: { Settings }, - connectors: { services: { Users, I18n, Limit }, models: { User } }, + connectors: { + services: { Users, I18n, Limit }, + models: { User }, + }, } = ctx; // downloadLinkLimiter can be used to limit downloads for the user's data to @@ -107,7 +115,10 @@ async function sendDownloadLink(ctx) { async function requestDeletion({ user, loaders: { Settings }, - connectors: { models: { User }, services: { Users, I18n } }, + connectors: { + models: { User }, + services: { Users, I18n }, + }, }) { // Ensure the user doesn't already have a deletion scheduled. if (get(user, 'metadata.scheduledDeletionDate')) { @@ -153,7 +164,10 @@ async function requestDeletion({ async function cancelDeletion({ user, loaders: { Settings }, - connectors: { models: { User }, services: { I18n, Users } }, + connectors: { + models: { User }, + services: { I18n, Users }, + }, }) { // Ensure the user has a deletion scheduled. const scheduledDeletionDate = get( diff --git a/plugins/talk-plugin-profile-data/server/router.js b/plugins/talk-plugin-profile-data/server/router.js index 6bd165e64..19dd69897 100644 --- a/plugins/talk-plugin-profile-data/server/router.js +++ b/plugins/talk-plugin-profile-data/server/router.js @@ -8,7 +8,11 @@ const stringify = require('csv-stringify'); const { ErrDownloadToken } = require('./errors'); async function verifyDownloadToken( - { connectors: { services: { Users } } }, + { + connectors: { + services: { Users }, + }, + }, token ) { const jwt = await Users.verifyToken(token, { @@ -139,7 +143,12 @@ module.exports = router => { return; } - const { connectors: { graph: { Context }, errors } } = req.context; + const { + connectors: { + graph: { Context }, + errors, + }, + } = req.context; try { // Pull the userID and the date that the token was issued out of the diff --git a/plugins/talk-plugin-slack-notifications/server/hooks.js b/plugins/talk-plugin-slack-notifications/server/hooks.js index 4133f795d..57c137e02 100644 --- a/plugins/talk-plugin-slack-notifications/server/hooks.js +++ b/plugins/talk-plugin-slack-notifications/server/hooks.js @@ -12,7 +12,9 @@ module.exports = { createComment: { async post(root, args, context, info, result) { debug(`Posting notification to Slack webhook: ${SLACK_WEBHOOK_URL}`); - const { comment: { body: text, created_at: createdAt } } = result; + const { + comment: { body: text, created_at: createdAt }, + } = result; const username = context.user.username; process.nextTick(async () => { const response = await fetch(SLACK_WEBHOOK_URL, { diff --git a/plugins/talk-plugin-toxic-comments/client/containers/CheckToxicityHook.js b/plugins/talk-plugin-toxic-comments/client/containers/CheckToxicityHook.js index 82322b112..dd888a63c 100644 --- a/plugins/talk-plugin-toxic-comments/client/containers/CheckToxicityHook.js +++ b/plugins/talk-plugin-toxic-comments/client/containers/CheckToxicityHook.js @@ -5,4 +5,7 @@ import CheckToxicityHook from '../components/CheckToxicityHook'; const mapDispatchToProps = dispatch => bindActionCreators({ notify }, dispatch); -export default connect(null, mapDispatchToProps)(CheckToxicityHook); +export default connect( + null, + mapDispatchToProps +)(CheckToxicityHook); diff --git a/plugins/talk-plugin-viewing-options/client/containers/ViewingOptions.js b/plugins/talk-plugin-viewing-options/client/containers/ViewingOptions.js index 0e1919383..9a7069681 100644 --- a/plugins/talk-plugin-viewing-options/client/containers/ViewingOptions.js +++ b/plugins/talk-plugin-viewing-options/client/containers/ViewingOptions.js @@ -29,7 +29,10 @@ const withViewingOptionsFragments = withFragments({ }); const enhance = compose( - connect(mapStateToProps, mapDispatchToProps), + connect( + mapStateToProps, + mapDispatchToProps + ), withViewingOptionsFragments, mapProps(({ root, asset, ...rest }) => ({ slotPassthrough: { diff --git a/routes/api/v1/setup.js b/routes/api/v1/setup.js index 553e42f44..14039f329 100644 --- a/routes/api/v1/setup.js +++ b/routes/api/v1/setup.js @@ -18,7 +18,10 @@ router.post('/', async (req, res, next) => { return next(e); } - const { settings, user: { email, password, username } } = req.body; + const { + settings, + user: { email, password, username }, + } = req.body; try { await SetupService.setup(req.context, { diff --git a/services/migration/helpers.js b/services/migration/helpers.js index 49acc78aa..35f0db916 100644 --- a/services/migration/helpers.js +++ b/services/migration/helpers.js @@ -27,7 +27,7 @@ const processUpdates = async (model, updates) => { const debugProcessStatistics = (count, totalCount) => { if (totalCount > 0) { debug( - `processed ${(count / totalCount * 100).toFixed( + `processed ${((count / totalCount) * 100).toFixed( 2 )}% (${count}/${totalCount}) updates` ); diff --git a/services/migration/index.js b/services/migration/index.js index e0da3cddf..af31c44e2 100644 --- a/services/migration/index.js +++ b/services/migration/index.js @@ -7,7 +7,11 @@ const debug = require('debug')('talk:services:migration'); const sc = require('snake-case'); const helpers = require('./helpers'); const { stripIndent } = require('common-tags'); -const { talk: { migration: { minVersion } } } = require('../../package.json'); +const { + talk: { + migration: { minVersion }, + }, +} = require('../../package.json'); const migrationTemplate = stripIndent` module.exports = { diff --git a/services/moderation/index.js b/services/moderation/index.js index cc3a74a73..20412072f 100644 --- a/services/moderation/index.js +++ b/services/moderation/index.js @@ -82,7 +82,9 @@ const compose = phases => async (ctx, comment, options) => { * @param {Object} comment comment object to use */ const fetchOptions = async (ctx, comment) => { - const { loaders: { Settings, Assets } } = ctx; + const { + loaders: { Settings, Assets }, + } = ctx; // Load the settings. const settings = await Settings.load(); diff --git a/services/moderation/phases/commentLength.js b/services/moderation/phases/commentLength.js index e19198ef1..bc199b86a 100644 --- a/services/moderation/phases/commentLength.js +++ b/services/moderation/phases/commentLength.js @@ -4,7 +4,11 @@ const { ErrCommentTooShort } = require('../../../errors'); module.exports = ( ctx, comment, - { asset: { settings: { charCountEnable, charCount } } } + { + asset: { + settings: { charCountEnable, charCount }, + }, + } ) => { // Check to see if the body is too short, if it is, then complain about it! if (comment.body.length < 2) { diff --git a/services/moderation/phases/karma.js b/services/moderation/phases/karma.js index 7a929824b..64f674266 100644 --- a/services/moderation/phases/karma.js +++ b/services/moderation/phases/karma.js @@ -3,7 +3,11 @@ const get = require('lodash/get'); // This phase checks to see if the user making the comment is allowed to do so // considering their reliability (Trust) status. module.exports = ctx => { - const { connectors: { services: { Karma } } } = ctx; + const { + connectors: { + services: { Karma }, + }, + } = ctx; const trust = get(ctx, 'user.metadata.trust', null); // If the user is not a reliable commenter (passed the unreliability diff --git a/services/moderation/phases/links.js b/services/moderation/phases/links.js index 0aed4ecd9..ec05834b6 100644 --- a/services/moderation/phases/links.js +++ b/services/moderation/phases/links.js @@ -5,7 +5,11 @@ const linkify = require('linkify-it')().tlds(require('tlds')); module.exports = ( ctx, comment, - { asset: { settings: { premodLinksEnable } } } + { + asset: { + settings: { premodLinksEnable }, + }, + } ) => { if (premodLinksEnable && linkify.test(comment.body)) { // Add the flag related to Trust to the comment. diff --git a/services/moderation/phases/premod.js b/services/moderation/phases/premod.js index cbd3627b1..db1a3fd1b 100644 --- a/services/moderation/phases/premod.js +++ b/services/moderation/phases/premod.js @@ -1,6 +1,14 @@ // This phase checks to see if the settings have premod enabled, if they do, // the comment is premod, otherwise, it's just none. -module.exports = (ctx, comment, { asset: { settings: { moderation } } }) => { +module.exports = ( + ctx, + comment, + { + asset: { + settings: { moderation }, + }, + } +) => { // If the settings say that we're in premod mode, then the comment is in // premod status. if (moderation === 'PRE') { diff --git a/services/moderation/phases/wordlist.js b/services/moderation/phases/wordlist.js index b71e0361e..769e893f1 100644 --- a/services/moderation/phases/wordlist.js +++ b/services/moderation/phases/wordlist.js @@ -2,7 +2,11 @@ const { DISABLE_AUTOFLAG_SUSPECT_WORDS } = require('../../../config'); // This phase checks the comment against the wordlist. module.exports = async (ctx, comment, { settings }) => { - const { connectors: { services: { Wordlist } } } = ctx; + const { + connectors: { + services: { Wordlist }, + }, + } = ctx; // Create a new instance of the Wordlist. const wl = new Wordlist(); diff --git a/services/mongoose.js b/services/mongoose.js index f6615ad39..db72eedec 100644 --- a/services/mongoose.js +++ b/services/mongoose.js @@ -44,11 +44,14 @@ if (WEBPACK) { // Connect to the Mongo instance. mongoose - .connect(MONGO_URL, { - config: { - autoIndex: CREATE_MONGO_INDEXES, - }, - }) + .connect( + MONGO_URL, + { + config: { + autoIndex: CREATE_MONGO_INDEXES, + }, + } + ) .catch(err => { console.error(err); process.exit(1); diff --git a/services/setup.js b/services/setup.js index a691550ef..126f31f0f 100644 --- a/services/setup.js +++ b/services/setup.js @@ -66,7 +66,13 @@ module.exports = class SetupService { /** * This will perform the setup. */ - static async setup(ctx, { settings, user: { email, password, username } }) { + static async setup( + ctx, + { + settings, + user: { email, password, username }, + } + ) { // Validate the settings first. await SetupService.validate({ settings, diff --git a/test/e2e/specs/01_install.js b/test/e2e/specs/01_install.js index 91f08f7af..5cdfb3380 100644 --- a/test/e2e/specs/01_install.js +++ b/test/e2e/specs/01_install.js @@ -57,7 +57,9 @@ module.exports = { }, 'User fills step 3': client => { const step3 = client.page.install().section.step3; - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; step3 .setValue('@emailInput', admin.email) diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 844e653fe..5acfd83f6 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -22,7 +22,9 @@ module.exports = { 'Admin logs in': client => { const adminPage = client.page.admin(); - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; adminPage.navigateAndLogin(admin); }, diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index d98c0f9a7..dbc217432 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -32,7 +32,9 @@ module.exports = { }, 'creates an user and user logs in': client => { - const { testData: { user } } = client.globals; + const { + testData: { user }, + } = client.globals; const embedStream = client.page.embedStream(); // Go back to default asset. @@ -99,7 +101,9 @@ module.exports = { comments.logout(); }, 'admin logs in': client => { - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; const embedStream = client.page.embedStream(); embedStream diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index dfcb3548c..189c93107 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -20,7 +20,9 @@ module.exports = { 'Admin logs in': client => { const adminPage = client.page.admin(); - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; adminPage.navigateAndLogin(admin); }, @@ -84,7 +86,9 @@ module.exports = { client.page.admin().logout(); }, 'user logs in': client => { - const { testData: { user } } = client.globals; + const { + testData: { user }, + } = client.globals; const embedStream = client.page.embedStream(); embedStream @@ -109,7 +113,9 @@ module.exports = { 'user picks another username': client => { const embedStream = client.page.embedStream(); const comments = embedStream.section.comments; - const { testData: { user } } = client.globals; + const { + testData: { user }, + } = client.globals; comments .waitForElementVisible('@changeUsernameInput') @@ -134,7 +140,9 @@ module.exports = { }, 'Admin accepts the user flag': client => { const adminPage = client.page.admin(); - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; adminPage.navigateAndLogin(admin); @@ -152,7 +160,9 @@ module.exports = { client.page.admin().logout(); }, 'user logs in to check comment': client => { - const { testData: { user } } = client.globals; + const { + testData: { user }, + } = client.globals; const embedStream = client.page.embedStream(); embedStream diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index 3f6a33cf9..f69a52fc3 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -21,7 +21,9 @@ module.exports = { 'admin logs in': client => { const adminPage = client.page.admin(); - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; adminPage.navigateAndLogin(admin); }, @@ -53,7 +55,9 @@ module.exports = { comments.logout(); }, 'user logs in': client => { - const { testData: { user } } = client.globals; + const { + testData: { user }, + } = client.globals; const comments = client.page.embedStream().section.comments; comments.openLoginPopup(popup => popup.login(user)); @@ -72,7 +76,9 @@ module.exports = { }, 'admin logs in (2)': client => { const adminPage = client.page.admin(); - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; adminPage.navigateAndLogin(admin); }, @@ -100,7 +106,9 @@ module.exports = { embedStream.navigate().ready(); }, 'user logs in 2': client => { - const { testData: { user } } = client.globals; + const { + testData: { user }, + } = client.globals; const comments = client.page.embedStream().section.comments; comments.openLoginPopup(popup => popup.login(user)); @@ -134,7 +142,9 @@ module.exports = { }, 'admin logs in (3)': client => { const adminPage = client.page.admin(); - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; adminPage.navigateAndLogin(admin); }, diff --git a/test/e2e/specs/06_suspendUser.js b/test/e2e/specs/06_suspendUser.js index 1febe820c..facd63804 100644 --- a/test/e2e/specs/06_suspendUser.js +++ b/test/e2e/specs/06_suspendUser.js @@ -19,7 +19,9 @@ module.exports = { client.end(); }, 'user logs in': client => { - const { testData: { user } } = client.globals; + const { + testData: { user }, + } = client.globals; const embedStream = client.page.embedStream(); const comments = client.page.embedStream().section.comments; @@ -48,7 +50,9 @@ module.exports = { }, 'admin logs in': client => { const adminPage = client.page.admin(); - const { testData: { admin } } = client.globals; + const { + testData: { admin }, + } = client.globals; adminPage.navigateAndLogin(admin); }, @@ -137,7 +141,9 @@ module.exports = { adminPage.logout(); }, 'user logs in (2)': client => { - const { testData: { user } } = client.globals; + const { + testData: { user }, + } = client.globals; const embedStream = client.page.embedStream(); const comments = client.page.embedStream().section.comments; diff --git a/test/server/graph/loaders/actions.js b/test/server/graph/loaders/actions.js index f8e96175b..7f7186fab 100644 --- a/test/server/graph/loaders/actions.js +++ b/test/server/graph/loaders/actions.js @@ -12,7 +12,9 @@ describe('graph.loaders.Actions', () => { { item_id: 'comment_1' }, { item_id: 'comment_2' }, ]); - const { Actions: { getAuthoredByID } } = loaders({ + const { + Actions: { getAuthoredByID }, + } = loaders({ user: { id: 'user_1' }, connectors: { services: { Actions: { getUserActions: spy } } }, }); @@ -34,7 +36,9 @@ describe('graph.loaders.Actions', () => { describe('#getSummariesByItem', () => { describe('logged out user', () => { it('does not include any user data', async () => { - const { Actions: { getSummariesByItem } } = loaders({ + const { + Actions: { getSummariesByItem }, + } = loaders({ loaders: { Actions: { getAuthoredByID: { @@ -72,7 +76,9 @@ describe('graph.loaders.Actions', () => { describe('logged in user', () => { it('does include user', async () => { - const { Actions: { getSummariesByItem } } = loaders({ + const { + Actions: { getSummariesByItem }, + } = loaders({ loaders: { Actions: { getAuthoredByID: { diff --git a/test/server/graph/mutations/createComment.js b/test/server/graph/mutations/createComment.js index 662404bf2..345f845c5 100644 --- a/test/server/graph/mutations/createComment.js +++ b/test/server/graph/mutations/createComment.js @@ -195,8 +195,7 @@ describe('graph.mutations.createComment', () => { AssetModel.create({ id: '123', settings: { disableCommenting: disabled }, - }) - ); + })); it( error ? 'does not create the comment' : 'creates the comment', @@ -234,8 +233,7 @@ describe('graph.mutations.createComment', () => { ].forEach(({ moderation, status }) => { describe(`moderation=${moderation}`, () => { beforeEach(() => - AssetModel.create({ id: '123', settings: { moderation } }) - ); + AssetModel.create({ id: '123', settings: { moderation } })); it(`creates comment with status=${status}`, () => { const context = new Context({ user: new UserModel() }); @@ -263,8 +261,7 @@ describe('graph.mutations.createComment', () => { SettingsService.update({ wordlist: { banned: ['WORST'], suspect: ['EH'] }, }), - ]) - ); + ])); [ { diff --git a/test/server/routes/api/auth/index.js b/test/server/routes/api/auth/index.js index f80fbbc37..30d235e5f 100644 --- a/test/server/routes/api/auth/index.js +++ b/test/server/routes/api/auth/index.js @@ -75,8 +75,7 @@ describe('/api/v1/auth/local', () => { describe('email confirmation enabled', () => { beforeEach(() => - SettingsService.update({ requireEmailConfirmation: true }) - ); + SettingsService.update({ requireEmailConfirmation: true })); describe('#post', () => { it('should not allow a login from a user that is not confirmed', () => { diff --git a/test/server/services/settings.js b/test/server/services/settings.js index ca6fdef8d..120a7da3d 100644 --- a/test/server/services/settings.js +++ b/test/server/services/settings.js @@ -7,8 +7,7 @@ describe('services.Settings', () => { Settings.init({ moderation: 'PRE', wordlist: { banned: ['bannedWord'], suspect: [] }, - }) - ); + })); describe('#retrieve()', () => { it('should have a moderation field defined', () => { diff --git a/test/server/services/tokens.js b/test/server/services/tokens.js index a6224eda4..2aa6819f8 100644 --- a/test/server/services/tokens.js +++ b/test/server/services/tokens.js @@ -38,7 +38,9 @@ describe('services.TokensService', () => { describe('#revoke', () => { it('can revoke a token', async () => { - let { pat: { id } } = await TokensService.create(user.id, 'GitHub Token'); + let { + pat: { id }, + } = await TokensService.create(user.id, 'GitHub Token'); let tokens = await TokensService.list(user.id); expect(tokens).to.have.length(1); @@ -57,7 +59,9 @@ describe('services.TokensService', () => { describe('#validate', () => { it('will allow a valid token', async () => { // Create a token. - let { pat: { id } } = await TokensService.create(user.id, 'GitHub Token'); + let { + pat: { id }, + } = await TokensService.create(user.id, 'GitHub Token'); // Validate it. await TokensService.validate(user.id, id); @@ -65,7 +69,9 @@ describe('services.TokensService', () => { it('will not allow an invalid token', async () => { // Create a token. - let { pat: { id } } = await TokensService.create(user.id, 'GitHub Token'); + let { + pat: { id }, + } = await TokensService.create(user.id, 'GitHub Token'); // Revoke it. await TokensService.revoke(user.id, id); @@ -81,7 +87,9 @@ describe('services.TokensService', () => { expect(tokens).to.have.length(0); // Create a token. - let { pat: { id } } = await TokensService.create(user.id, 'GitHub Token'); + let { + pat: { id }, + } = await TokensService.create(user.id, 'GitHub Token'); tokens = await TokensService.list(user.id); expect(tokens).to.have.length(1);