From d9d086c61ec3bfa235238f7c56f18e7fb63e09f1 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Mon, 6 Mar 2017 13:53:56 -0700 Subject: [PATCH 1/4] remove a banned comment after it's confirmed as rejected --- client/coral-framework/graphql/mutations/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/coral-framework/graphql/mutations/index.js b/client/coral-framework/graphql/mutations/index.js index a874f8f0c..40469a18e 100644 --- a/client/coral-framework/graphql/mutations/index.js +++ b/client/coral-framework/graphql/mutations/index.js @@ -42,6 +42,10 @@ export const postComment = graphql(POST_COMMENT, { updateQueries: { AssetQuery: (oldData, {mutationResult:{data:{createComment:{comment}}}}) => { + if (comment.status === 'REJECTED') { + return oldData; + } + if (oldData.asset.settings.moderation === 'PRE') { return oldData; } From 3a31ca8d3892074382d4558f218fd80671291311 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Tue, 7 Mar 2017 10:06:03 -0700 Subject: [PATCH 2/4] blur the comment until it's ready --- client/coral-embed-stream/src/Comment.css | 7 ++++++- client/coral-embed-stream/src/Comment.js | 1 + client/coral-framework/graphql/mutations/index.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.css b/client/coral-embed-stream/src/Comment.css index 7bc1a21f4..6966d82ab 100644 --- a/client/coral-embed-stream/src/Comment.css +++ b/client/coral-embed-stream/src/Comment.css @@ -3,5 +3,10 @@ } .Comment { - + +} + +.pendingComment { + filter: blur(2px); + pointer-events: none; } diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 72449c906..059c366ff 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -116,6 +116,7 @@ class Comment extends React.Component { const dontagree = getActionSummary('DontAgreeActionSummary', comment); let commentClass = parentId ? `reply ${styles.Reply}` : `comment ${styles.Comment}`; commentClass += highlighted === comment.id ? ' highlighted-comment' : ''; + commentClass += comment.id === 'pending' ? ' pendingComment' : ''; // call a function, and if it errors, call addNotification('error', ...) (e.g. to show user a snackbar) const notifyOnError = (fn, errorToMessage) => async () => { diff --git a/client/coral-framework/graphql/mutations/index.js b/client/coral-framework/graphql/mutations/index.js index 40469a18e..d319c2f8f 100644 --- a/client/coral-framework/graphql/mutations/index.js +++ b/client/coral-framework/graphql/mutations/index.js @@ -35,7 +35,7 @@ export const postComment = graphql(POST_COMMENT, { action_summaries: [], tags: [], status: null, - id: `${Date.now()}_temp_id` + id: 'pending' } } }, From 5e4c251e835e82a24fab61dc0f2373f902a7a673 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Tue, 7 Mar 2017 10:47:51 -0700 Subject: [PATCH 3/4] style the pending comment correctly --- client/coral-embed-stream/src/Comment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 059c366ff..0a3cdb78b 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -116,7 +116,7 @@ class Comment extends React.Component { const dontagree = getActionSummary('DontAgreeActionSummary', comment); let commentClass = parentId ? `reply ${styles.Reply}` : `comment ${styles.Comment}`; commentClass += highlighted === comment.id ? ' highlighted-comment' : ''; - commentClass += comment.id === 'pending' ? ' pendingComment' : ''; + commentClass += comment.id === 'pending' ? ` ${styles.pendingComment}` : ''; // call a function, and if it errors, call addNotification('error', ...) (e.g. to show user a snackbar) const notifyOnError = (fn, errorToMessage) => async () => { From 0863ca26ff357b5d0309578e0ceb494b04ae5383 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Wed, 8 Mar 2017 09:56:36 -0700 Subject: [PATCH 4/4] update dashboard links --- .../src/containers/Dashboard/FlagWidget.js | 13 +++++++------ .../src/containers/Dashboard/LikeWidget.js | 13 +++++++------ .../src/containers/Dashboard/Widget.css | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/client/coral-admin/src/containers/Dashboard/FlagWidget.js b/client/coral-admin/src/containers/Dashboard/FlagWidget.js index da71ac04a..4b86ec7d7 100644 --- a/client/coral-admin/src/containers/Dashboard/FlagWidget.js +++ b/client/coral-admin/src/containers/Dashboard/FlagWidget.js @@ -16,7 +16,7 @@ const FlagWidget = (props) => { {lang.t('streams.article')} - {lang.t('dashboard.flags')} + {lang.t('dashboard.flags')} @@ -27,20 +27,21 @@ const FlagWidget = (props) => { return ( - +

{asset.title}

{asset.author} — Published: {new Date(asset.created_at).toLocaleDateString()}

- -

{flagSummary ? flagSummary.actionCount : 0}

- +

{flagSummary ? flagSummary.actionCount : 0}

+ + + Moderate ); }) - : {lang.t('dashboard.no_flags')} + : {lang.t('dashboard.no_flags')} } { /* rows in a table with a fixed height will expand and ignore height. this extra row will expand to fill the extra space. */ diff --git a/client/coral-admin/src/containers/Dashboard/LikeWidget.js b/client/coral-admin/src/containers/Dashboard/LikeWidget.js index 25e851966..d52676ae4 100644 --- a/client/coral-admin/src/containers/Dashboard/LikeWidget.js +++ b/client/coral-admin/src/containers/Dashboard/LikeWidget.js @@ -17,7 +17,7 @@ const LikeWidget = (props) => { {lang.t('streams.article')} - {lang.t('modqueue.likes')} + {lang.t('modqueue.likes')} @@ -28,20 +28,21 @@ const LikeWidget = (props) => { return ( - +

{asset.title}

{asset.author} — Published: {new Date(asset.created_at).toLocaleDateString()}

- -

{likeSummary ? likeSummary.actionCount : 0}

- +

{likeSummary ? likeSummary.actionCount : 0}

+ + + Moderate ); }) - : {lang.t('dashboard.no_likes')} + : {lang.t('dashboard.no_likes')} } { /* rows in a table with a fixed height will expand and ignore height. this extra row will expand to fill the extra space. */ diff --git a/client/coral-admin/src/containers/Dashboard/Widget.css b/client/coral-admin/src/containers/Dashboard/Widget.css index cb764d9cc..3170cf332 100644 --- a/client/coral-admin/src/containers/Dashboard/Widget.css +++ b/client/coral-admin/src/containers/Dashboard/Widget.css @@ -55,11 +55,26 @@ padding: 10px; } +.widgetTable tbody td:last-child { + padding-top: 0; +} + .linkToAsset { display: block; text-decoration: none; } +.linkToModerate { + background-color: #e0e0e0; + padding: 10px 14px; + text-decoration: none; + color: black; +} + +.linkToModerate:hover { + background-color: #ccc; +} + .lede { font-size: 0.9em; color: #aaa;