From ada5e6f747c7740967f6488e11fbb6cf555479b4 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 11 Aug 2017 19:53:08 +0700 Subject: [PATCH 1/6] Update apollo and fix warnings --- .../coral-embed-stream/src/graphql/index.js | 10 ++- package.json | 4 +- yarn.lock | 84 +++++++++++-------- 3 files changed, 57 insertions(+), 41 deletions(-) diff --git a/client/coral-embed-stream/src/graphql/index.js b/client/coral-embed-stream/src/graphql/index.js index f52cc4e7d..2c39235a2 100644 --- a/client/coral-embed-stream/src/graphql/index.js +++ b/client/coral-embed-stream/src/graphql/index.js @@ -152,8 +152,6 @@ const extension = { }, created_at: new Date().toISOString(), body, - parent_id, - asset_id, action_summaries: [], tags: tags.map((tag) => ({ tag: { @@ -169,8 +167,14 @@ const extension = { })), status: 'NONE', replyCount: 0, + asset: { + __typename: 'Asset', + id: asset_id, + title: '', + url: '', + }, parent: parent_id - ? {id: parent_id} + ? {__typename: 'Comment', id: parent_id} : null, replies: { __typename: 'CommentConnection', diff --git a/package.json b/package.json index bb0a724ac..ebe1138f6 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "passport-local": "^1.0.0", "prop-types": "^15.5.10", "query-strings": "^0.0.1", - "react-apollo": "^1.1.0", + "react-apollo": "^1.4.12", "react-input-autosize": "^1.1.4", "react-recaptcha": "^2.2.6", "react-toastify": "^1.5.0", @@ -136,7 +136,7 @@ "yamljs": "^0.2.10" }, "devDependencies": { - "apollo-client": "^1.0.4", + "apollo-client": "^1.9.1", "autoprefixer": "^6.5.2", "babel-cli": "^6.24.0", "babel-core": "^6.24.0", diff --git a/yarn.lock b/yarn.lock index a5d73a756..9c1ac35e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,10 +9,6 @@ git-url-parse "^6.0.2" shelljs "^0.7.0" -"@types/async@^2.0.31": - version "2.0.40" - resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.40.tgz#ac02de68e66c004a61b7cb16df8b1db3a254cca9" - "@types/express-serve-static-core@*": version "4.0.44" resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.0.44.tgz#a1c3bd5d80e93c72fba91a03f5412c47f21d4ae7" @@ -26,18 +22,18 @@ "@types/express-serve-static-core" "*" "@types/serve-static" "*" +"@types/graphql@0.10.2": + version "0.10.2" + resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.10.2.tgz#d7c79acbaa17453b6681c80c34b38fcb10c4c08c" + "@types/graphql@^0.8.5", "@types/graphql@^0.8.6": version "0.8.6" resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.8.6.tgz#b34fb880493ba835b0c067024ee70130d6f9bb68" -"@types/graphql@^0.9.0", "@types/graphql@^0.9.1": +"@types/graphql@^0.9.1": version "0.9.1" resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.9.1.tgz#b04ebe84bc997cc60dbea2ed4d0d4342c737f99d" -"@types/isomorphic-fetch@0.0.33": - version "0.0.33" - resolved "https://registry.yarnpkg.com/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.33.tgz#3ea1b86f8b73e6a7430d01d4dbd5b1f63fd72718" - "@types/mime@*": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-0.0.29.tgz#fbcfd330573b912ef59eeee14602bface630754b" @@ -203,20 +199,27 @@ anymatch@^1.3.0: arrify "^1.0.0" micromatch "^2.1.5" -apollo-client@^1.0.2, apollo-client@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-1.0.4.tgz#af75db8cdd27e08a835ddfb39807849e178540f9" +apollo-client@^1.4.0, apollo-client@^1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-1.9.1.tgz#9e6a383605572c755038cf5d7fdac9382bcdc040" dependencies: - graphql "^0.9.3" + apollo-link-core "^0.5.0" + graphql "^0.10.0" graphql-anywhere "^3.0.1" graphql-tag "^2.0.0" redux "^3.4.0" symbol-observable "^1.0.2" whatwg-fetch "^2.0.0" optionalDependencies: - "@types/async" "^2.0.31" - "@types/graphql" "^0.9.0" - "@types/isomorphic-fetch" "0.0.33" + "@types/graphql" "0.10.2" + +apollo-link-core@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/apollo-link-core/-/apollo-link-core-0.5.0.tgz#dc87da1aaa63b029321ae70938dc26257f5ab8c6" + dependencies: + graphql "^0.10.3" + graphql-tag "^2.4.2" + zen-observable-ts "^0.4.0" app-module-path@^2.2.0: version "2.2.0" @@ -3711,6 +3714,10 @@ graphql-tag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.0.0.tgz#f3efe3b4d64f33bfe8479ae06a461c9d72f2a6fe" +graphql-tag@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.4.2.tgz#6a63297d8522d03a2b72d26f1b239aab343840cd" + graphql-tools@^0.10.1: version "0.10.1" resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-0.10.1.tgz#274aa338d50b1c0b3ed6936eafd8ed3a19ed1828" @@ -3721,13 +3728,19 @@ graphql-tools@^0.10.1: optionalDependencies: "@types/graphql" "^0.8.5" +graphql@^0.10.0, graphql@^0.10.3: + version "0.10.5" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.10.5.tgz#c9be17ca2bdfdbd134077ffd9bbaa48b8becd298" + dependencies: + iterall "^1.1.0" + graphql@^0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.7.2.tgz#cc894a32823399b8a0cb012b9e9ecad35cd00f72" dependencies: iterall "1.0.2" -graphql@^0.9.1, graphql@^0.9.3: +graphql@^0.9.1: version "0.9.3" resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.9.3.tgz#71fc0fa331bffb9c20678485861cfb370803118e" dependencies: @@ -3876,6 +3889,10 @@ hoist-non-react-statics@^1.0.0, hoist-non-react-statics@^1.0.3, hoist-non-react- version "1.2.0" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb" +hoist-non-react-statics@^2.2.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.2.2.tgz#c0eca5a7d5a28c5ada3107eb763b01da6bfa81fb" + home-or-tmp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" @@ -3996,11 +4013,11 @@ iconv-lite@0.4.13: version "0.4.13" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" -iconv-lite@0.4.15, iconv-lite@^0.4.5, iconv-lite@~0.4.13: +iconv-lite@0.4.15: version "0.4.15" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb" -iconv-lite@^0.4.17: +iconv-lite@^0.4.17, iconv-lite@^0.4.5, iconv-lite@~0.4.13: version "0.4.18" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2" @@ -4531,7 +4548,7 @@ iterall@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.0.3.tgz#e0b31958f835013c323ff0b10943829ac69aa4b7" -iterall@^1.1.1: +iterall@^1.1.0, iterall@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.1.tgz#f7f0af11e9a04ec6426260f5019d9fcca4d50214" @@ -6912,14 +6929,14 @@ react-addons-test-utils@^15.4.2: fbjs "^0.8.4" object-assign "^4.1.0" -react-apollo@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-1.1.1.tgz#136a6be6e0ed7bfa5292e67073e1829fe12e1e17" +react-apollo@^1.4.12: + version "1.4.12" + resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-1.4.12.tgz#0cacbdd335acec4c1079feb48047df1c43f77bdf" dependencies: - apollo-client "^1.0.2" + apollo-client "^1.4.0" graphql-anywhere "^3.0.0" graphql-tag "^2.0.0" - hoist-non-react-statics "^1.2.0" + hoist-non-react-statics "^2.2.0" invariant "^2.2.1" lodash.flatten "^4.2.0" lodash.isequal "^4.1.1" @@ -6927,10 +6944,8 @@ react-apollo@^1.1.0: lodash.pick "^4.4.0" object-assign "^4.0.1" prop-types "^15.5.8" - optionalDependencies: - react-dom "0.14.x || 15.* || ^15.0.0" -"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1, react-dom@^15.4.2: +react-dom@^15.3.1, react-dom@^15.4.2: version "15.5.4" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.5.4.tgz#ba0c28786fd52ed7e4f2135fe0288d462aef93da" dependencies: @@ -7869,14 +7884,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^3.0.0" - -string-width@^2.1.0: +string-width@^2.0.0, string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: @@ -8816,3 +8824,7 @@ yauzl@^2.5.0: dependencies: buffer-crc32 "~0.2.3" fd-slicer "~1.0.1" + +zen-observable-ts@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.4.0.tgz#a74bc9fe59747948a577bd513d438e70fcfae7e2" From 17bc396b06fea740c11d28177031f500d770570d Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 11 Aug 2017 20:55:23 +0700 Subject: [PATCH 2/6] Fix Ignored User in permalink --- client/coral-embed-stream/style/default.css | 2 +- client/coral-framework/hocs/withMutation.js | 4 ++-- client/coral-framework/hocs/withQuery.js | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css index 802cd2e5b..6ba376096 100644 --- a/client/coral-embed-stream/style/default.css +++ b/client/coral-embed-stream/style/default.css @@ -13,7 +13,7 @@ body { width: 100%; font-size: 14px; margin: 0px; - padding: 0px 0px 50px 0px; + padding: 0px 0px 100px 0px; height: auto !important; } diff --git a/client/coral-framework/hocs/withMutation.js b/client/coral-framework/hocs/withMutation.js index c9108c0fe..7e2c3d09d 100644 --- a/client/coral-framework/hocs/withMutation.js +++ b/client/coral-framework/hocs/withMutation.js @@ -92,13 +92,13 @@ export default (document, config = {}) => (WrappedComponent) => { // Do not run updates when we have mutation errors. return prev; } - return map[key](prev, result); + return map[key](prev, result) || prev; }; } else { const existing = res[key]; res[key] = (prev, result) => { const next = existing(prev, result); - return map[key](next, result); + return map[key](next, result) || next; }; } }); diff --git a/client/coral-framework/hocs/withQuery.js b/client/coral-framework/hocs/withQuery.js index adb67b7b3..82c9c29d4 100644 --- a/client/coral-framework/hocs/withQuery.js +++ b/client/coral-framework/hocs/withQuery.js @@ -128,8 +128,10 @@ export default (document, config = {}) => (WrappedComponent) => { const reducer = withSkipOnErrors( reducerCallbacks.reduce( - (a, b) => (prev, ...rest) => - b(a(prev, ...rest), ...rest), + (a, b) => (prev, ...rest) => { + const next = a(prev, ...rest); + return b(next, ...rest) || next; + } )); return { From 45cf72256beab523c779e54fc547a2f4a13115a5 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 11 Aug 2017 21:11:59 +0700 Subject: [PATCH 3/6] Fix dashboard links --- .../src/routes/Dashboard/components/ActivityWidget.js | 6 +++--- .../src/routes/Dashboard/components/FlagWidget.js | 6 +++--- .../src/routes/Dashboard/components/LikeWidget.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/coral-admin/src/routes/Dashboard/components/ActivityWidget.js b/client/coral-admin/src/routes/Dashboard/components/ActivityWidget.js index 5f974971c..d92b2bd14 100644 --- a/client/coral-admin/src/routes/Dashboard/components/ActivityWidget.js +++ b/client/coral-admin/src/routes/Dashboard/components/ActivityWidget.js @@ -17,11 +17,11 @@ const ActivityWidget = ({assets}) => { ? assets.map((asset) => { return (
- Moderate + Moderate

{asset.commentCount}

- +

{asset.title}

- +

{asset.author} — Published: {new Date(asset.created_at).toLocaleDateString()}

); diff --git a/client/coral-admin/src/routes/Dashboard/components/FlagWidget.js b/client/coral-admin/src/routes/Dashboard/components/FlagWidget.js index ef0974fbd..ef4a6857e 100644 --- a/client/coral-admin/src/routes/Dashboard/components/FlagWidget.js +++ b/client/coral-admin/src/routes/Dashboard/components/FlagWidget.js @@ -24,11 +24,11 @@ const FlagWidget = ({assets}) => { return (
- Moderate + Moderate

{flagSummary ? flagSummary.actionCount : 0}

- +

{asset.title}

- +

{asset.author} — Published: {new Date(asset.created_at).toLocaleDateString()}

); diff --git a/client/coral-admin/src/routes/Dashboard/components/LikeWidget.js b/client/coral-admin/src/routes/Dashboard/components/LikeWidget.js index 2188e38dd..a61f888bf 100644 --- a/client/coral-admin/src/routes/Dashboard/components/LikeWidget.js +++ b/client/coral-admin/src/routes/Dashboard/components/LikeWidget.js @@ -19,11 +19,11 @@ const LikeWidget = ({assets}) => { const likeSummary = asset.action_summaries.find((s) => s.type === 'LikeAssetActionSummary'); return (
- Moderate + Moderate

{likeSummary ? likeSummary.actionCount : 0}

- +

{asset.title}

- +

{asset.author} — Published: {new Date(asset.created_at).toLocaleDateString()}

); From abda77a7e725fe4fa2a304527d51ec21994a7fb3 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 14 Aug 2017 19:55:04 +0700 Subject: [PATCH 4/6] Fix console error in offtopic --- .../talk-plugin-offtopic/client/components/OffTopicFilter.js | 1 - .../talk-plugin-offtopic/client/containers/OffTopicFilter.js | 4 ---- 2 files changed, 5 deletions(-) diff --git a/plugins/talk-plugin-offtopic/client/components/OffTopicFilter.js b/plugins/talk-plugin-offtopic/client/components/OffTopicFilter.js index 171bafeb2..426dea29a 100644 --- a/plugins/talk-plugin-offtopic/client/components/OffTopicFilter.js +++ b/plugins/talk-plugin-offtopic/client/components/OffTopicFilter.js @@ -16,7 +16,6 @@ export default class OffTopicFilter extends React.Component { this.props.removeCommentClassName(idx); this.props.toggleCheckbox(); } - this.props.closeViewingOptions(); } render() { diff --git a/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js b/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js index 9548b764e..7eab8c526 100644 --- a/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js +++ b/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js @@ -3,9 +3,6 @@ import {bindActionCreators} from 'redux'; import {toggleCheckbox} from '../actions'; import {commentClassNamesSelector} from 'plugin-api/alpha/client/selectors'; import OffTopicFilter from '../components/OffTopicFilter'; -import { - closeViewingOptions -} from 'plugins/talk-plugin-viewing-options/client/actions'; import { addCommentClassName, removeCommentClassName @@ -20,7 +17,6 @@ const mapDispatchToProps = (dispatch) => bindActionCreators( { toggleCheckbox, - closeViewingOptions, addCommentClassName, removeCommentClassName }, From c52a97338c7ad05e1ea115436bf0d39624619842 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 14 Aug 2017 21:25:48 +0700 Subject: [PATCH 5/6] Fix FakeComment styles --- .../client/components/CreateUsernameDialog.js | 2 +- .../client/components/FakeComment.css | 37 ++++++++++ .../client/components/FakeComment.js | 72 +++++++------------ 3 files changed, 63 insertions(+), 48 deletions(-) create mode 100644 plugins/talk-plugin-auth/client/components/FakeComment.css diff --git a/plugins/talk-plugin-auth/client/components/CreateUsernameDialog.js b/plugins/talk-plugin-auth/client/components/CreateUsernameDialog.js index 12916b4dd..4b0babed6 100644 --- a/plugins/talk-plugin-auth/client/components/CreateUsernameDialog.js +++ b/plugins/talk-plugin-auth/client/components/CreateUsernameDialog.js @@ -32,7 +32,7 @@ const CreateUsernameDialog = ({ className={styles.fakeComment} username={formData.username} created_at={Date.now()} - comment={{body:t('createdisplay.fake_comment_body')}} + body={t('createdisplay.fake_comment_body')} />

{t('createdisplay.if_you_dont_change_your_name')} diff --git a/plugins/talk-plugin-auth/client/components/FakeComment.css b/plugins/talk-plugin-auth/client/components/FakeComment.css new file mode 100644 index 000000000..8b5521aea --- /dev/null +++ b/plugins/talk-plugin-auth/client/components/FakeComment.css @@ -0,0 +1,37 @@ +.root { + border-top: 1px solid rgba(0, 0, 0, 0.1); + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + margin-bottom: 10px; + padding: 8px 0px 10px 0px; + position: relative; +} + +.body { + +} + +.footer { + display: flex; + justify-content: space-between; +} + +.button { + color: #2a2a2a; + margin: 5px 10px 5px 0px; + background: none; + padding: 0px; + border: none; + font-size: inherit; + vertical-align: middle; + + &:hover { + color: #767676; + cursor: pointer; + } +} + +.icon { + font-size: 12px; + padding: 0 2px 0 5px; + vertical-align: middle; +} diff --git a/plugins/talk-plugin-auth/client/components/FakeComment.js b/plugins/talk-plugin-auth/client/components/FakeComment.js index b6b4e7609..eefada587 100644 --- a/plugins/talk-plugin-auth/client/components/FakeComment.js +++ b/plugins/talk-plugin-auth/client/components/FakeComment.js @@ -2,65 +2,43 @@ import React from 'react'; import t from 'coral-framework/services/i18n'; import {ReplyButton} from 'talk-plugin-replies'; import PubDate from 'talk-plugin-pubdate/PubDate'; -import Slot from 'coral-framework/components/Slot'; import AuthorName from 'talk-plugin-author-name/AuthorName'; -import styles from 'coral-embed-stream/src/components/Comment.css'; +import styles from './FakeComment.css'; +import {Icon} from 'plugin-api/beta/client/components/ui'; -export const FakeComment = ({username, created_at, comment}) => ( -

-
- +export const FakeComment = ({username, created_at, body}) => ( +
+ - -
-
- + {}} + parentCommentId={'commentID'} + currentUserId={{}} + />
- {}} - parentCommentId={'commentID'} - currentUserId={{}} - /> -
-
-
- -
-
-
From db37a0b38ef3226ee34be491eb2622e65b0646b0 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 15 Aug 2017 16:43:44 +0700 Subject: [PATCH 6/6] Check existance of featuredComments in query --- plugins/talk-plugin-featured-comments/client/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/talk-plugin-featured-comments/client/index.js b/plugins/talk-plugin-featured-comments/client/index.js index 82cba8b91..ad10f87ca 100644 --- a/plugins/talk-plugin-featured-comments/client/index.js +++ b/plugins/talk-plugin-featured-comments/client/index.js @@ -26,6 +26,9 @@ export default { IgnoreUser: ({variables}) => ({ updateQueries: { CoralEmbedStream_Embed: (previous) => { + if (!previous.asset.featuredComments) { + return previous; + } const ignoredUserId = variables.id; const newNodes = previous.asset.featuredComments.nodes.filter((n) => n.user.id !== ignoredUserId); const removedCount = previous.asset.featuredComments.nodes.length - newNodes.length;