From 3dc2674f47e961eb8eb6df46fcc1c5daf98465c9 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Thu, 20 Apr 2017 14:33:49 -0600 Subject: [PATCH 1/2] the pre-mod tab does not request action_summaries since there wouldn't be any --- .../src/containers/ModerationQueue/components/Comment.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js index b18f239e4..217697a4a 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js @@ -21,8 +21,13 @@ const lang = new I18n(translations); const Comment = ({actions = [], comment, ...props}) => { const links = linkify.getMatches(comment.body); const linkText = links ? links.map(link => link.raw) : []; - const flagActionSummaries = getActionSummary('FlagActionSummary', comment); - const flagActions = comment.actions && comment.actions.filter(a => a.__typename === 'FlagAction'); + + let flagActionSummaries; + let flagActions; + if (comment.action_summaries) { // this might be missing if we're on the pre-mod tab + flagActionSummaries = getActionSummary('FlagActionSummary', comment); + flagActions = comment.actions && comment.actions.filter(a => a.__typename === 'FlagAction'); + } return (
  • From 8708fcf2cd7e29bd9865368534a98d5d302dfed2 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Thu, 20 Apr 2017 14:37:48 -0600 Subject: [PATCH 2/2] actually, we want to have the action_summaries on all requests, since a plugin could potentially pre-flag a pre-mod comment --- .../src/containers/ModerationQueue/components/Comment.js | 9 ++------- .../src/graphql/fragments/commentView.graphql | 6 ++++++ .../src/graphql/queries/modQueueQuery.graphql | 6 ------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js index 217697a4a..b18f239e4 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js @@ -21,13 +21,8 @@ const lang = new I18n(translations); const Comment = ({actions = [], comment, ...props}) => { const links = linkify.getMatches(comment.body); const linkText = links ? links.map(link => link.raw) : []; - - let flagActionSummaries; - let flagActions; - if (comment.action_summaries) { // this might be missing if we're on the pre-mod tab - flagActionSummaries = getActionSummary('FlagActionSummary', comment); - flagActions = comment.actions && comment.actions.filter(a => a.__typename === 'FlagAction'); - } + const flagActionSummaries = getActionSummary('FlagActionSummary', comment); + const flagActions = comment.actions && comment.actions.filter(a => a.__typename === 'FlagAction'); return (
  • diff --git a/client/coral-admin/src/graphql/fragments/commentView.graphql b/client/coral-admin/src/graphql/fragments/commentView.graphql index 8c7310bdf..51b0a3f44 100644 --- a/client/coral-admin/src/graphql/fragments/commentView.graphql +++ b/client/coral-admin/src/graphql/fragments/commentView.graphql @@ -12,6 +12,12 @@ fragment commentView on Comment { id title } + action_summaries { + count + ... on FlagActionSummary { + reason + } + } actions { ... on FlagAction { reason diff --git a/client/coral-admin/src/graphql/queries/modQueueQuery.graphql b/client/coral-admin/src/graphql/queries/modQueueQuery.graphql index b4f2a20a0..da8760be9 100644 --- a/client/coral-admin/src/graphql/queries/modQueueQuery.graphql +++ b/client/coral-admin/src/graphql/queries/modQueueQuery.graphql @@ -15,12 +15,6 @@ query ModQueue ($asset_id: ID, $sort: SORT_ORDER) { sort: $sort }) { ...commentView - action_summaries { - count - ... on FlagActionSummary { - reason - } - } } rejected: comments(query: { statuses: [REJECTED],