From d9d086c61ec3bfa235238f7c56f18e7fb63e09f1 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Mon, 6 Mar 2017 13:53:56 -0700 Subject: [PATCH 1/3] 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/3] 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/3] 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 () => {