From ef759e068bcf1a6e12454c0b469c7f4e650c092c Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 25 Jul 2017 19:14:03 +0700 Subject: [PATCH] Adapt query helpers --- client/coral-embed-stream/src/graphql/utils.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/coral-embed-stream/src/graphql/utils.js b/client/coral-embed-stream/src/graphql/utils.js index 4f51b0ae2..1030a3547 100644 --- a/client/coral-embed-stream/src/graphql/utils.js +++ b/client/coral-embed-stream/src/graphql/utils.js @@ -12,8 +12,8 @@ function determineCommentDepth(comment) { } function applyToCommentsOrigin(root, callback) { - if (root.comment) { - let comment = root.comment; + if (root.asset.comment) { + let comment = root.asset.comment; for (let depth = 0; depth <= determineCommentDepth(comment); depth++) { let changes = {$apply: (node) => node ? callback(node) : node}; for (let i = 0; i < depth; i++) { @@ -24,7 +24,10 @@ function applyToCommentsOrigin(root, callback) { return { ...root, - comment, + asset: { + ...root.asset, + comment, + }, }; } return update(root, { @@ -135,8 +138,8 @@ export function findCommentInEmbedQuery(root, callbackOrId) { if (typeof callbackOrId === 'string') { callback = (node) => node.id === callbackOrId; } - if (root.comment) { - return findComment([getTopLevelParent(root.comment)], callback); + if (root.asset.comment) { + return findComment([getTopLevelParent(root.asset.comment)], callback); } if (!root.asset.comments) { return false;