From f140efe1bd6ae026be33f652b3cf438c5251e587 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 31 Aug 2017 11:10:28 -0300 Subject: [PATCH 01/12] Premod and New Queue Edge Case --- .../src/routes/Moderation/containers/Moderation.js | 11 ++++++++--- .../coral-admin/src/routes/Moderation/queueConfig.js | 10 +++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index 722faaaa3..336ec1770 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -215,11 +215,16 @@ class ModerationContainer extends Component { } const premodEnabled = assetId ? isPremod(asset.settings.moderation) : isPremod(settings.moderation); + const currentQueueConfig = Object.assign({}, this.props.queueConfig); + + if (premodEnabled) { - delete currentQueueConfig.new; - } else { - delete currentQueueConfig.premod; + delete currentQueueConfig.new + } + + if (!root.premodCount || premodEnabled) { + delete currentQueueConfig.premod } return Date: Thu, 31 Aug 2017 11:30:11 -0300 Subject: [PATCH 02/12] premod and new --- .../src/routes/Moderation/containers/Moderation.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index 336ec1770..523e5bf3f 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -218,13 +218,13 @@ class ModerationContainer extends Component { const currentQueueConfig = Object.assign({}, this.props.queueConfig); + console.log('premodEnabled', premodEnabled); + console.log('root.premodCount', root.premodCount) if (premodEnabled) { - delete currentQueueConfig.new - } - - if (!root.premodCount || premodEnabled) { - delete currentQueueConfig.premod + delete currentQueueConfig.new; + } else if (root.premodCount === 0) { + delete currentQueueConfig.premod; } return Date: Thu, 31 Aug 2017 11:41:20 -0300 Subject: [PATCH 03/12] Grabbing settings from the store --- .../src/routes/Moderation/containers/Moderation.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index 523e5bf3f..a128af456 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -190,7 +190,7 @@ class ModerationContainer extends Component { }; render () { - const {root, root: {asset, settings}, data} = this.props; + const {root, root: {asset}, data, settings} = this.props; const assetId = getAssetId(this.props); if (data.error) { @@ -208,19 +208,17 @@ class ModerationContainer extends Component { // Still loading. return ; } - } else if(asset !== undefined || !('premodCount' in root)) { + } else if (asset !== undefined || !('premodCount' in root)) { // loading. return ; } - const premodEnabled = assetId ? isPremod(asset.settings.moderation) : isPremod(settings.moderation); + const premodEnabled = assetId ? isPremod(asset.settings.moderation) : + isPremod(settings.moderation); const currentQueueConfig = Object.assign({}, this.props.queueConfig); - console.log('premodEnabled', premodEnabled); - console.log('root.premodCount', root.premodCount) - if (premodEnabled) { delete currentQueueConfig.new; } else if (root.premodCount === 0) { From 23c8e2a0e6d69b82ee8c9bcb63c9795830366aa1 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 31 Aug 2017 12:53:47 -0300 Subject: [PATCH 04/12] Refetching settings :) --- .../src/routes/Moderation/containers/Moderation.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index a128af456..a4770e28d 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -190,7 +190,7 @@ class ModerationContainer extends Component { }; render () { - const {root, root: {asset}, data, settings} = this.props; + const {root, root: {asset, settings}, data} = this.props; const assetId = getAssetId(this.props); if (data.error) { @@ -358,8 +358,9 @@ const withModQueueQuery = withQuery(({queueConfig}) => gql` variables: { asset_id: id, sortOrder: props.moderation.sortOrder, - allAssets: id === null - } + allAssets: id === null, + }, + fetchPolicy: 'network-only' }; }, }); From af0e9bc880a4876b1bd6246fd6404bc66ba587de Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 31 Aug 2017 13:02:07 -0300 Subject: [PATCH 05/12] New Queue should appear if there are comments with `NONE` status --- .../coral-admin/src/routes/Moderation/containers/Moderation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index a4770e28d..b266fe190 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -219,7 +219,7 @@ class ModerationContainer extends Component { const currentQueueConfig = Object.assign({}, this.props.queueConfig); - if (premodEnabled) { + if (premodEnabled && root.newCount === 0) { delete currentQueueConfig.new; } else if (root.premodCount === 0) { delete currentQueueConfig.premod; From 99235df5669c8fa5df0afbe41ef76cbb0e426136 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 31 Aug 2017 13:17:34 -0300 Subject: [PATCH 06/12] No premod status to the New Queue --- client/coral-admin/src/routes/Moderation/queueConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-admin/src/routes/Moderation/queueConfig.js b/client/coral-admin/src/routes/Moderation/queueConfig.js index bf3caf823..86a622177 100644 --- a/client/coral-admin/src/routes/Moderation/queueConfig.js +++ b/client/coral-admin/src/routes/Moderation/queueConfig.js @@ -2,7 +2,7 @@ import t from 'coral-framework/services/i18n'; export default { new: { - statuses: ['NONE', 'PREMOD'], + statuses: ['NONE'], icon: 'question_answer', name: t('modqueue.new'), }, From 36c4c6a59f4be731380d3ff6b5285868e21793a1 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 31 Aug 2017 14:22:59 -0300 Subject: [PATCH 07/12] Ready --- .../src/routes/Moderation/containers/Moderation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index b266fe190..2ff6b6732 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -221,7 +221,9 @@ class ModerationContainer extends Component { if (premodEnabled && root.newCount === 0) { delete currentQueueConfig.new; - } else if (root.premodCount === 0) { + } + + if (!premodEnabled && root.premodCount === 0) { delete currentQueueConfig.premod; } From d161733cdc25ddb552d0b12732445207ff58e786 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 31 Aug 2017 13:59:00 -0600 Subject: [PATCH 08/12] fixed path joining --- .../coral-admin/src/routes/Configure/components/EmbedLink.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/coral-admin/src/routes/Configure/components/EmbedLink.js b/client/coral-admin/src/routes/Configure/components/EmbedLink.js index 4506d2f06..be0a13d5e 100644 --- a/client/coral-admin/src/routes/Configure/components/EmbedLink.js +++ b/client/coral-admin/src/routes/Configure/components/EmbedLink.js @@ -1,5 +1,6 @@ import React, {Component} from 'react'; import t from 'coral-framework/services/i18n'; +import {join} from 'path'; import styles from './Configure.css'; import {Button, Card} from 'coral-ui'; import {BASE_URL} from 'coral-framework/constants/url'; @@ -25,7 +26,7 @@ class EmbedLink extends Component { } render () { - const coralJsUrl = [BASE_URL, '/embed.js'].join(''); + const coralJsUrl = join(BASE_URL, '/embed.js'); const nonce = String(Math.random()).slice(2); const streamElementId = `coral_talk_${nonce}`; const embedText = ` From e368c50687762e70da0446a37ca9aa328639bc58 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 1 Sep 2017 08:44:25 -0600 Subject: [PATCH 09/12] ioredis changed config, fixes #901 --- services/redis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/redis.js b/services/redis.js index 027d5bc20..59ab3eef8 100644 --- a/services/redis.js +++ b/services/redis.js @@ -65,7 +65,7 @@ const connectionOptions = { }; const createClient = () => { - let client = new Redis(connectionOptions); + let client = new Redis(REDIS_URL, connectionOptions); // Attach the monitors that will print debug messages to the console. attachMonitors(client); From 644788ea319ddb0edd8a741cb1f05ff40d2bd474 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 1 Sep 2017 08:47:08 -0600 Subject: [PATCH 10/12] removed unused option --- services/redis.js | 1 - 1 file changed, 1 deletion(-) diff --git a/services/redis.js b/services/redis.js index 59ab3eef8..5fd1b78d3 100644 --- a/services/redis.js +++ b/services/redis.js @@ -30,7 +30,6 @@ const attachMonitors = (client) => { }; const connectionOptions = { - url: REDIS_URL, retry_strategy: function(options) { if (options.error && options.error.code !== 'ECONNREFUSED') { From 7bb4b03daa8af7cdaffb277aeec3e285bd6c36b8 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 1 Sep 2017 12:17:48 -0300 Subject: [PATCH 11/12] Retrieving me from Comment triggers a change --- client/coral-embed-stream/src/containers/Comment.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/coral-embed-stream/src/containers/Comment.js b/client/coral-embed-stream/src/containers/Comment.js index a4bfbc0eb..37f6e6ebc 100644 --- a/client/coral-embed-stream/src/containers/Comment.js +++ b/client/coral-embed-stream/src/containers/Comment.js @@ -91,6 +91,11 @@ const singleCommentFragment = gql` const withCommentFragments = withFragments({ root: gql` fragment CoralEmbedStream_Comment_root on RootQuery { + me { + ignoredUsers { + id + } + } __typename ${getSlotFragmentSpreads(slots, 'root')} } From 26bae69454ec0e51bc86c3f2b36f568b5095e9bf Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Sun, 3 Sep 2017 19:36:02 +0700 Subject: [PATCH 12/12] Fix bug when determining moderation queues for live updates --- .../coral-admin/src/routes/Moderation/graphql.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client/coral-admin/src/routes/Moderation/graphql.js b/client/coral-admin/src/routes/Moderation/graphql.js index 28ca259d8..866218d73 100644 --- a/client/coral-admin/src/routes/Moderation/graphql.js +++ b/client/coral-admin/src/routes/Moderation/graphql.js @@ -69,15 +69,15 @@ function getCommentQueues(comment, queueConfig) { const queues = []; Object.keys(queueConfig).forEach((key) => { const {action_type, statuses, tags} = queueConfig[key]; - let addToQueues = false; - if (statuses && statuses.indexOf(comment.status) >= 0) { - addToQueues = true; + let addToQueues = true; + if (statuses && statuses.indexOf(comment.status) === -1) { + addToQueues = false; } - if (tags && comment.tags && comment.tags.some((tagLink) => tags.indexOf(tagLink.tag.name) >= 0)) { - addToQueues = true; + if (tags && (!comment.tags || !comment.tags.some((tagLink) => tags.indexOf(tagLink.tag.name) >= 0))) { + addToQueues = false; } - if (action_type && comment.actions && comment.actions.some((a) => a.__typename.toLowerCase() === `${action_type}action`)) { - addToQueues = true; + if (action_type && (!comment.actions || !comment.actions.some((a) => a.__typename.toLowerCase() === `${action_type.toLowerCase()}action`))) { + addToQueues = false; } if (addToQueues) { queues.push(key);