[CORL-421, CORL-415] Live Comments on Stream (#2379)

* feat: support comment replies

* feat: comment created

* feat: live update top level comments

* feat: live updates on the stream embed

* fix: tests

* chore: refactor FadeInTransition

* fix: add missing translation and a live update bug

* fix: graqphql

* feat: improve loading experiene :-)

* fix: live comment bugs

* chore: adapt translation

* feat: stop live updates when story is closed or commenting is disabled

* test: add tests for stream live updates

* fix: remove forgotten piece of code

* fix: tests
This commit is contained in:
Vinh
2019-06-28 23:20:10 +00:00
committed by Wyatt Johnson
parent e77103d872
commit 414a4c2a42
72 changed files with 2105 additions and 496 deletions
@@ -32,8 +32,10 @@ export function denormalizeComment(
return createFixture<GQLComment>({
...comment,
replies: { edges: replyEdges, pageInfo: repliesPageInfo },
replyCount: replyEdges.length,
replyCount:
comment.replyCount !== undefined ? comment.replyCount : replyEdges.length,
parentCount: parents.length,
parent: parents.length > 0 ? parents[parents.length - 1].node : undefined,
parents: {
edges: parents,
pageInfo: { startCursor: null, hasPreviousPage: false },
@@ -55,9 +57,15 @@ export function denormalizeStory(story: Fixture<GQLStory>) {
}))) ||
[];
const commentsPageInfo = (story.comments && story.comments.pageInfo) || {
endCursor: null,
hasNextPage: false,
};
if (commentsPageInfo.endCursor === undefined) {
commentsPageInfo.endCursor =
commentNodes.length > 0
? commentNodes[commentNodes.length - 1].node.createdAt
: null;
}
const featuredCommentsCount = commentNodes.filter(
n => n.tags && n.tags.some((t: GQLTag) => t.code === GQLTAG.FEATURED)
).length;