From 06ba5a53c1e8264b5f4f9d5beb2ae45a931b7ba3 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 26 Apr 2017 22:33:49 -0300 Subject: [PATCH 01/20] Stateless Slot --- client/coral-framework/components/Slot.js | 24 ++++++++++------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index c1e5dfe65..ad4847fcb 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -1,20 +1,16 @@ -import React, {Component} from 'react'; -import {getSlotElements} from 'coral-framework/helpers/plugins'; +import React from 'react'; +import cn from 'classnames'; import styles from './Slot.css'; +import {getSlotElements} from 'coral-framework/helpers/plugins'; -class Slot extends Component { - render() { - const {fill, inline = false, ...rest} = this.props; - return ( -
- {getSlotElements(fill, rest)} -
- ); - } +export default function Slot ({fill, inline = false, ...rest}) { + return ( +
+ {getSlotElements(fill, rest)} +
+ ); } Slot.propTypes = { fill: React.PropTypes.string -}; - -export default Slot; +}; \ No newline at end of file From 9fa3e361b58175db12df0a2496790a9522fdc225 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 26 Apr 2017 22:34:17 -0300 Subject: [PATCH 02/20] Ref Stream --- .../src/components/Stream.js | 286 +++++++++--------- 1 file changed, 147 insertions(+), 139 deletions(-) diff --git a/client/coral-embed-stream/src/components/Stream.js b/client/coral-embed-stream/src/components/Stream.js index 2875d0397..50f2800a3 100644 --- a/client/coral-embed-stream/src/components/Stream.js +++ b/client/coral-embed-stream/src/components/Stream.js @@ -1,28 +1,30 @@ import React, {PropTypes} from 'react'; + import {Button} from 'coral-ui'; -import Comment from '../containers/Comment'; -import CommentBox from 'coral-plugin-commentbox/CommentBox'; -import SuspendedAccount from 'coral-framework/components/SuspendedAccount'; -import RestrictedContent from 'coral-framework/components/RestrictedContent'; -import ChangeUsernameContainer from 'coral-sign-in/containers/ChangeUsernameContainer'; -import IgnoredCommentTombstone from './IgnoredCommentTombstone'; -import InfoBox from 'coral-plugin-infobox/InfoBox'; -import QuestionBox from 'coral-plugin-questionbox/QuestionBox'; import LoadMore from './LoadMore'; import NewCount from './NewCount'; +import Comment from '../containers/Comment'; +import Slot from 'coral-framework/components/Slot'; +import InfoBox from 'coral-plugin-infobox/InfoBox'; import {ModerationLink} from 'coral-plugin-moderation'; +import CommentBox from 'coral-plugin-commentbox/CommentBox'; +import QuestionBox from 'coral-plugin-questionbox/QuestionBox'; +import IgnoredCommentTombstone from './IgnoredCommentTombstone'; +import SuspendedAccount from 'coral-framework/components/SuspendedAccount'; +import RestrictedContent from 'coral-framework/components/RestrictedContent'; +import ChangeUsernameContainer + from 'coral-sign-in/containers/ChangeUsernameContainer'; class Stream extends React.Component { - - setActiveReplyBox = (reactKey) => { + setActiveReplyBox = reactKey => { if (!this.props.auth.user) { this.props.showSignInDialog(); } else { this.props.setActiveReplyBox(reactKey); } - } + }; - render () { + render() { const { root: {asset, asset: {comments}, comment, myIgnoredUsers}, postItem, @@ -39,152 +41,158 @@ class Stream extends React.Component { ignoreUser, auth: {loggedIn, isAdmin, user}, commentCountCache, - editName, + editName } = this.props; const open = asset.closedAt === null; // even though the permalinked comment is the highlighted one, we're displaying its parent + replies - const highlightedComment = comment && comment.parent ? comment.parent : comment; + const highlightedComment = comment && comment.parent + ? comment.parent + : comment; const banned = user && user.status === 'BANNED'; - const hasOlderComments = !!( - asset && + const hasOlderComments = !!(asset && asset.lastComment && - asset.lastComment.id !== asset.comments[asset.comments.length - 1].id - ); + asset.lastComment.id !== asset.comments[asset.comments.length - 1].id); // Find the created_at date of the first comment. If no comments exist, set the date to a week ago. const firstCommentDate = asset.comments[0] ? asset.comments[0].created_at : new Date(Date.now() - 1000 * 60 * 60 * 24 * 7).toISOString(); - const commentIsIgnored = (comment) => myIgnoredUsers && myIgnoredUsers.includes(comment.user.id); + const commentIsIgnored = comment => + myIgnoredUsers && myIgnoredUsers.includes(comment.user.id); return ( -
- { - open - ?
- - - - }> - { - user - ? - : null - } - -
- :

{asset.settings.closedMessage}

- } - {!loggedIn && } - {loggedIn && user && } +
+ {open + ?
+ + + + } + > + {user + ? + : null} + +
+ :

{asset.settings.closedMessage}

} + {!loggedIn && + } + {loggedIn && + user && + } {loggedIn && } {/* the highlightedComment is isolated after the user followed a permalink */} - { - highlightedComment + {highlightedComment ? - :
- + :
+ -
- { - comments.map(comment => - commentIsIgnored(comment) - ? - : - ) - } -
- -
- } +
+ {comments.map( + comment => + (commentIsIgnored(comment) + ? + : ) + )} +
+ +
}
); } @@ -201,7 +209,7 @@ Stream.propTypes = { removeCommentTag: PropTypes.func, // dispatch action to ignore another user - ignoreUser: React.PropTypes.func, + ignoreUser: React.PropTypes.func }; export default Stream; From 1fea1405ef4bfac74855ca398335add61df26a00 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 26 Apr 2017 22:34:38 -0300 Subject: [PATCH 03/20] Adding Slots, CommentBox ref --- client/coral-plugin-commentbox/CommentBox.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 6dd2d486f..44017ab52 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -1,13 +1,14 @@ -import React, {Component, PropTypes} from 'react'; +import React, {PropTypes} from 'react'; +import {Button} from 'coral-ui'; +import {connect} from 'react-redux'; import {I18n} from '../coral-framework'; import translations from './translations.json'; -import {Button} from 'coral-ui'; import Slot from 'coral-framework/components/Slot'; -import {connect} from 'react-redux'; + const name = 'coral-plugin-commentbox'; -class CommentBox extends Component { +class CommentBox extends React.Component { constructor(props) { super(props); @@ -151,13 +152,14 @@ class CommentBox extends Component { id={isReply ? 'replyText' : 'commentText'} onChange={this.handleChange} rows={3}/> +
maxCharCount ? `${name}-char-max` : ''}`}> {maxCharCount && `${maxCharCount - length} ${lang.t('characters-remaining')}`}
Date: Wed, 26 Apr 2017 22:35:30 -0300 Subject: [PATCH 04/20] Adding Slots to QuestionBox, ref --- client/coral-plugin-questionbox/QuestionBox.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/coral-plugin-questionbox/QuestionBox.js b/client/coral-plugin-questionbox/QuestionBox.js index 31ad45869..3ad439c2a 100644 --- a/client/coral-plugin-questionbox/QuestionBox.js +++ b/client/coral-plugin-questionbox/QuestionBox.js @@ -1,5 +1,6 @@ import React from 'react'; const packagename = 'coral-plugin-questionbox'; +import Slot from 'coral-framework/components/Slot'; const QuestionBox = ({enable, content}) =>
@@ -10,6 +11,7 @@ const QuestionBox = ({enable, content}) =>
{content}
+
; export default QuestionBox; From 29e398c51d7e8765f001d4b9d8db25b7f8a396f0 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 26 Apr 2017 22:37:37 -0300 Subject: [PATCH 05/20] Rename Slot to commentInputDetailArea in Coral Plugin Offtopic --- plugins/coral-plugin-offtopic/client/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/coral-plugin-offtopic/client/index.js b/plugins/coral-plugin-offtopic/client/index.js index c006c9a9e..071f37a40 100644 --- a/plugins/coral-plugin-offtopic/client/index.js +++ b/plugins/coral-plugin-offtopic/client/index.js @@ -3,7 +3,7 @@ import OffTopicTag from './components/OffTopicTag'; export default { slots: { - commentBoxDetail: [OffTopicCheckbox], + commentInputDetailArea: [OffTopicCheckbox], commentInfoBar: [OffTopicTag] } }; From e0b177d955ca39414bfe65d900ba9480674171fa Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 26 Apr 2017 23:02:09 -0300 Subject: [PATCH 06/20] Updated slot name --- plugins/coral-plugin-respect/client/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index a336786d6..e5baccb59 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -2,6 +2,6 @@ import RespectButton from './containers/RespectButton'; export default { slots: { - commentDetail: [RespectButton], + commentActions: [RespectButton], } }; From 00fe4b7c83c374c37e076e46dfcff8aa94cea03a Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 26 Apr 2017 23:03:51 -0300 Subject: [PATCH 07/20] =?UTF-8?q?=C3=9Apdating=20slot=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/coral-framework/helpers/plugins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index df50fdcb7..87ac35975 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -44,7 +44,7 @@ function getComponentFragments(components) { * Returns an object that can be used to compose fragments or queries. * * Example: - * const pluginFragments = getSlotsFragments(['commentInfoBar', 'commentDetail']); + * const pluginFragments = getSlotsFragments(['commentInfoBar', 'commentActions']); * const rootFragment = gql` * fragment Comment_root on RootQuery { + ${pluginFragments.spreads('root')} From c60db4104793cc8aa6f0b581bbad572ff704b7eb Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 26 Apr 2017 23:04:22 -0300 Subject: [PATCH 08/20] Updating slot name --- client/coral-embed-stream/src/containers/Comment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-embed-stream/src/containers/Comment.js b/client/coral-embed-stream/src/containers/Comment.js index 524f7ec62..6c8a38177 100644 --- a/client/coral-embed-stream/src/containers/Comment.js +++ b/client/coral-embed-stream/src/containers/Comment.js @@ -3,7 +3,7 @@ import Comment from '../components/Comment'; import withFragments from 'coral-framework/hocs/withFragments'; import {getSlotsFragments} from 'coral-framework/helpers/plugins'; -const pluginFragments = getSlotsFragments(['commentInfoBar', 'commentDetail']); +const pluginFragments = getSlotsFragments(['commentInfoBar', 'commentActions']); export default withFragments({ root: gql` From de6492a26d29f985ced286114f628cdd31300a31 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 26 Apr 2017 23:06:09 -0300 Subject: [PATCH 09/20] =?UTF-8?q?=C3=81dding=20reactions,=20commentContent?= =?UTF-8?q?=20and=20updating=20current=20Slot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/coral-embed-stream/src/components/Comment.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index 4f8426159..7ce143c55 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -197,7 +197,9 @@ class Comment extends React.Component { } +
+ {/* TODO implmement iPerformedThisAction for the like */} Date: Wed, 26 Apr 2017 23:15:40 -0300 Subject: [PATCH 10/20] Linting --- client/coral-embed-stream/src/components/Stream.js | 1 - client/coral-framework/components/Slot.js | 2 +- client/coral-plugin-commentbox/CommentBox.js | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/client/coral-embed-stream/src/components/Stream.js b/client/coral-embed-stream/src/components/Stream.js index 50f2800a3..eb30dc16c 100644 --- a/client/coral-embed-stream/src/components/Stream.js +++ b/client/coral-embed-stream/src/components/Stream.js @@ -4,7 +4,6 @@ import {Button} from 'coral-ui'; import LoadMore from './LoadMore'; import NewCount from './NewCount'; import Comment from '../containers/Comment'; -import Slot from 'coral-framework/components/Slot'; import InfoBox from 'coral-plugin-infobox/InfoBox'; import {ModerationLink} from 'coral-plugin-moderation'; import CommentBox from 'coral-plugin-commentbox/CommentBox'; diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index ad4847fcb..8e2dd9502 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -13,4 +13,4 @@ export default function Slot ({fill, inline = false, ...rest}) { Slot.propTypes = { fill: React.PropTypes.string -}; \ No newline at end of file +}; diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 44017ab52..5d0906b6e 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -5,7 +5,6 @@ import {I18n} from '../coral-framework'; import translations from './translations.json'; import Slot from 'coral-framework/components/Slot'; - const name = 'coral-plugin-commentbox'; class CommentBox extends React.Component { From 862355b0cd2dc1eed498cbaf7d62859f261886f3 Mon Sep 17 00:00:00 2001 From: riley Date: Thu, 27 Apr 2017 14:02:29 -0600 Subject: [PATCH 11/20] don't double count no-ops --- .../src/graphql/mutations/index.js | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/client/coral-admin/src/graphql/mutations/index.js b/client/coral-admin/src/graphql/mutations/index.js index 364243cb1..f2845887b 100644 --- a/client/coral-admin/src/graphql/mutations/index.js +++ b/client/coral-admin/src/graphql/mutations/index.js @@ -55,15 +55,24 @@ export const setCommentStatus = graphql(SET_COMMENT_STATUS, { updateQueries: { ModQueue: (oldData) => { const comment = oldData.all.find(c => c.id === commentId); - comment.status = 'ACCEPTED'; + let accepted; + let acceptedCount = oldData.acceptedCount; + + // if the comment was already in the Approved queue, don't re-add it + if (comment.status === 'ACCEPTED') { + accepted = [...oldData.accepted]; + } else { + comment.status = 'ACCEPTED'; + acceptedCount++; + accepted = [comment, ...oldData.accepted] + } + const premod = oldData.premod.filter(c => c.id !== commentId); const flagged = oldData.flagged.filter(c => c.id !== commentId); - const accepted = [comment].concat(oldData.accepted); const rejected = oldData.rejected.filter(c => c.id !== commentId); const premodCount = premod.length < oldData.premod.length ? oldData.premodCount - 1 : oldData.premodCount; const flaggedCount = flagged.length < oldData.flagged.length ? oldData.flaggedCount - 1 : oldData.flaggedCount; const rejectedCount = rejected.length < oldData.rejected.length ? oldData.rejectedCount - 1 : oldData.rejectedCount; - const acceptedCount = oldData.acceptedCount + 1; return { ...oldData, @@ -89,14 +98,23 @@ export const setCommentStatus = graphql(SET_COMMENT_STATUS, { updateQueries: { ModQueue: (oldData) => { const comment = oldData.all.find(c => c.id === commentId); - comment.status = 'REJECTED'; - const rejected = [comment].concat(oldData.rejected); + let rejected; + let rejectedCount = oldData.rejectedCount; + + // if the item was already in the Rejected queue, don't put it in again + if (comment.status === 'REJECTED') { + rejected = oldData.rejected; + } else { + comment.status = 'REJECTED'; + rejectedCount++; + rejected = [comment, ...oldData.rejected]; + } + const premod = oldData.premod.filter(c => c.id !== commentId); const flagged = oldData.flagged.filter(c => c.id !== commentId); const accepted = oldData.accepted.filter(c => c.id !== commentId); const premodCount = premod.length < oldData.premod.length ? oldData.premodCount - 1 : oldData.premodCount; const flaggedCount = flagged.length < oldData.flagged.length ? oldData.flaggedCount - 1 : oldData.flaggedCount; - const rejectedCount = oldData.rejectedCount + 1; const acceptedCount = accepted.length < oldData.accepted.length ? oldData.acceptedCount - 1 : oldData.acceptedCount; return { From 59ddde185633a2488a49e36a7d6e81140c697bb1 Mon Sep 17 00:00:00 2001 From: riley Date: Thu, 27 Apr 2017 14:07:01 -0600 Subject: [PATCH 12/20] semi --- client/coral-admin/src/graphql/mutations/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-admin/src/graphql/mutations/index.js b/client/coral-admin/src/graphql/mutations/index.js index f2845887b..4d62201d1 100644 --- a/client/coral-admin/src/graphql/mutations/index.js +++ b/client/coral-admin/src/graphql/mutations/index.js @@ -64,7 +64,7 @@ export const setCommentStatus = graphql(SET_COMMENT_STATUS, { } else { comment.status = 'ACCEPTED'; acceptedCount++; - accepted = [comment, ...oldData.accepted] + accepted = [comment, ...oldData.accepted]; } const premod = oldData.premod.filter(c => c.id !== commentId); From a46c8528e19683e1fdc9c86f5c1d179cd915ea51 Mon Sep 17 00:00:00 2001 From: Andrew Losowsky Date: Fri, 28 Apr 2017 07:19:44 -0400 Subject: [PATCH 13/20] tiny typo that was bugging me --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 49033acc8..aed9cbad8 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -243,7 +243,7 @@ file under the `scripts` key including: # Setup Once you've installed Talk (either via Docker or source), you still need to -setup the application. If you are unfamiliar with any terminoligy used in the +setup the application. If you are unfamiliar with any terminology used in the setup process, refer to the `TERMINOLOGY.md` document. ## Via Web From 5d26f8e3de389a79bea716e0c5d09cbb51922d3e Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 26 Apr 2017 19:37:07 +0700 Subject: [PATCH 14/20] Ret empty string when encountering undefined fragment --- client/coral-framework/helpers/plugins.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index df50fdcb7..26311a513 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -65,10 +65,10 @@ export function getSlotsFragments(slots) { const fragments = getComponentFragments(components); return { spreads(key) { - return fragments[key] && fragments[key].spreads; + return (fragments[key] && fragments[key].spreads) || ''; }, definitions(key) { - return fragments[key] && fragments[key].definitions; + return (fragments[key] && fragments[key].definitions) || ''; }, }; } From ace3e2398b5e02d1e2226b848c28973c8c2d74bb Mon Sep 17 00:00:00 2001 From: riley Date: Fri, 28 Apr 2017 11:41:03 -0600 Subject: [PATCH 15/20] 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 16/20] 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 17/20] 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 18/20] 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 19/20] 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 From d14b965f54a162e272279654f18b9702c1191150 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 1 May 2017 10:46:37 -0300 Subject: [PATCH 20/20] Adding fragment slots --- client/coral-embed-stream/src/containers/Comment.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/coral-embed-stream/src/containers/Comment.js b/client/coral-embed-stream/src/containers/Comment.js index 6c8a38177..9b48e0809 100644 --- a/client/coral-embed-stream/src/containers/Comment.js +++ b/client/coral-embed-stream/src/containers/Comment.js @@ -3,7 +3,15 @@ import Comment from '../components/Comment'; import withFragments from 'coral-framework/hocs/withFragments'; import {getSlotsFragments} from 'coral-framework/helpers/plugins'; -const pluginFragments = getSlotsFragments(['commentInfoBar', 'commentActions']); +const pluginFragments = getSlotsFragments([ + 'streamQuestionArea', + 'commentInputArea', + 'commentInputDetailArea', + 'commentInfoBar', + 'commentActions', + 'commentContent', + 'commentReactions' +]); export default withFragments({ root: gql` @@ -36,5 +44,5 @@ export default withFragments({ ${pluginFragments.spreads('comment')} } ${pluginFragments.definitions('comment')} - `, + ` })(Comment);