From ace3e2398b5e02d1e2226b848c28973c8c2d74bb Mon Sep 17 00:00:00 2001 From: riley Date: Fri, 28 Apr 2017 11:41:03 -0600 Subject: [PATCH 1/5] enable load more on accepted queue --- client/coral-admin/src/graphql/queries/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/coral-admin/src/graphql/queries/index.js b/client/coral-admin/src/graphql/queries/index.js index 53113558b..9d2357ce7 100644 --- a/client/coral-admin/src/graphql/queries/index.js +++ b/client/coral-admin/src/graphql/queries/index.js @@ -39,6 +39,9 @@ export const loadMore = (fetchMore) => ({limit, cursor, sort, tab, asset_id}) => case 'all': statuses = null; break; + case 'accepted': + statuses = ['ACCEPTED']; + break; case 'premod': statuses = ['PREMOD']; break; From f1e70102d0e44d0e71743651e90c1608e007f585 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 28 Apr 2017 11:55:28 -0600 Subject: [PATCH 2/5] Updated yarn.lock --- yarn.lock | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index 81a4c7a41..99703bdf3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6863,19 +6863,7 @@ readable-stream@1.1, readable-stream@1.1.x: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@2, readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.2.2, readable-stream@^2.2.6: - version "2.2.9" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.9.tgz#cf78ec6f4a6d1eb43d26488cac97f042e74b7fc8" - dependencies: - buffer-shims "~1.0.0" - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~1.0.0" - util-deprecate "~1.0.1" - -readable-stream@2.2.7: +readable-stream@2, readable-stream@2.2.7, readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.2.2, readable-stream@^2.2.6: version "2.2.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.7.tgz#07057acbe2467b22042d36f98c5ad507054e95b1" dependencies: From 8663aa0cb51136c35c3aa4247b1534d8765107df Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Sat, 29 Apr 2017 01:02:11 +0700 Subject: [PATCH 3/5] Fix polling reply count --- .../src/containers/Stream.js | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/client/coral-embed-stream/src/containers/Stream.js b/client/coral-embed-stream/src/containers/Stream.js index 4415f5f94..49f234dab 100644 --- a/client/coral-embed-stream/src/containers/Stream.js +++ b/client/coral-embed-stream/src/containers/Stream.js @@ -19,24 +19,13 @@ const {showSignInDialog} = authActions; const {addNotification} = notificationActions; class StreamContainer extends React.Component { - getCounts = ({asset_id, limit, sort}) => { + getCounts = (variables) => { return this.props.data.fetchMore({ query: LOAD_COMMENT_COUNTS_QUERY, - variables: { - asset_id, - limit, - sort, - excludeIgnored: this.props.data.variables.excludeIgnored, - }, - updateQuery: (oldData, {fetchMoreResult:{asset}}) => { - return { - ...oldData, - asset: { - ...oldData.asset, - commentCount: asset.commentCount - } - }; - } + variables, + + // Apollo requires this, even though we don't use it... + updateQuery: data => data, }); }; @@ -122,12 +111,7 @@ class StreamContainer extends React.Component { this.props.data.refetch(); } this.countPoll = setInterval(() => { - const {asset} = this.props.root; - this.getCounts({ - asset_id: asset.id, - limit: asset.comments.length, - sort: 'REVERSE_CHRONOLOGICAL' - }); + this.getCounts(this.props.data.variables); }, NEW_COMMENT_COUNT_POLL_INTERVAL); } @@ -141,13 +125,13 @@ class StreamContainer extends React.Component { } const LOAD_COMMENT_COUNTS_QUERY = gql` - query LoadCommentCounts($asset_id: ID, $limit: Int = 5, $sort: SORT_ORDER) { - asset(id: $asset_id) { + query LoadCommentCounts($assetUrl: String, $assetId: ID, $excludeIgnored: Boolean) { + asset(id: $assetId, url: $assetUrl) { id - commentCount - comments(sort: $sort, limit: $limit) { + commentCount(excludeIgnored: $excludeIgnored) + comments(limit: 10) { id - replyCount + replyCount(excludeIgnored: $excludeIgnored) } } } From e486d485561233fd1baf2e36954067b6d1bb7d90 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Sat, 29 Apr 2017 01:02:59 +0700 Subject: [PATCH 4/5] postComment should increase replyCount --- client/coral-framework/graphql/mutations/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-framework/graphql/mutations/index.js b/client/coral-framework/graphql/mutations/index.js index eb0b5386a..b1ea57ae1 100644 --- a/client/coral-framework/graphql/mutations/index.js +++ b/client/coral-framework/graphql/mutations/index.js @@ -57,7 +57,7 @@ export const postComment = graphql(POST_COMMENT, { ...oldData.asset, comments: oldData.asset.comments.map((oldComment) => { return oldComment.id === parent_id - ? {...oldComment, replies: [...oldComment.replies, comment]} + ? {...oldComment, replies: [...oldComment.replies, comment], replyCount: oldComment.replyCount + 1} : oldComment; }) } From 5d4c81380031ff26c51b0f64d99f0806be1f5321 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 28 Apr 2017 12:03:29 -0600 Subject: [PATCH 5/5] removed empty gif --- out.gif | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 out.gif diff --git a/out.gif b/out.gif deleted file mode 100644 index e69de29bb..000000000