From 647227e66cffacc0f48c6f117ed7751f8712dd38 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 21 Mar 2019 18:37:35 +0000 Subject: [PATCH] feat: renamed me -> viewer (#2238) --- src/core/client/admin/components/App.spec.tsx | 2 +- src/core/client/admin/components/App.tsx | 6 +-- .../__snapshots__/App.spec.tsx.snap | 2 +- .../client/admin/containers/AppContainer.tsx | 6 +-- .../admin/containers/AuthCheckContainer.tsx | 24 ++++----- .../containers/RedirectLoginContainer.tsx | 14 +++--- .../admin/containers/UserMenuContainer.tsx | 10 ++-- .../containers/AccountCompletionContainer.tsx | 18 +++---- .../login/containers/LoginContainer.tsx | 6 +-- .../test/auth/accountCompletion.spec.tsx | 12 ++--- .../admin/test/auth/addEmailAddress.spec.tsx | 2 +- .../admin/test/auth/createPassword.spec.tsx | 2 +- .../admin/test/auth/redirectLoggedIn.spec.tsx | 2 +- .../admin/test/auth/restricted.spec.tsx | 2 +- .../client/admin/test/auth/signOut.spec.tsx | 2 +- .../admin/test/configure/advanced.spec.tsx | 2 +- .../client/admin/test/configure/auth.spec.tsx | 2 +- .../admin/test/configure/general.spec.tsx | 2 +- .../admin/test/configure/moderation.spec.tsx | 2 +- .../test/configure/organization.spec.tsx | 2 +- .../admin/test/configure/wordList.spec.tsx | 2 +- .../decisionHistory/decisionHistory.spec.tsx | 2 +- .../admin/test/moderate/moderate.spec.tsx | 2 +- .../containers/DecisionHistoryContainer.tsx | 16 +++--- .../queries/DecisionHistoryQuery.tsx | 8 +-- .../containers/RestrictedContainer.tsx | 12 ++--- .../containers/AccountCompletionContainer.tsx | 18 +++---- .../client/auth/containers/AppContainer.tsx | 14 +++--- src/core/client/auth/queries/AppQuery.tsx | 8 +-- .../auth/test/accountCompletion.spec.tsx | 12 ++--- .../helpers/{getMe.ts => getViewer.ts} | 8 +-- ...{getMeSourceID.ts => getViewerSourceID.ts} | 4 +- src/core/client/framework/helpers/index.ts | 4 +- .../stream/containers/TabBarContainer.tsx | 11 ++-- .../containers/UserBoxContainer.spec.tsx | 10 ++-- .../stream/containers/UserBoxContainer.tsx | 14 +++--- .../CreateCommentDontAgreeMutation.ts | 2 +- .../mutations/CreateCommentFlagMutation.ts | 2 +- .../stream/mutations/CreateCommentMutation.ts | 6 +-- .../CreateCommentReactionMutation.ts | 2 +- .../mutations/CreateCommentReplyMutation.ts | 12 ++--- .../RemoveCommentReactionMutation.ts | 2 +- .../client/stream/queries/TabBarQuery.tsx | 6 +-- .../comments/components/ReplyList.spec.tsx | 4 +- .../tabs/comments/components/ReplyList.tsx | 4 +- .../tabs/comments/components/Stream.spec.tsx | 6 +-- .../tabs/comments/components/Stream.tsx | 14 +++--- .../__snapshots__/ReplyList.spec.tsx.snap | 12 ++--- .../__snapshots__/Stream.spec.tsx.snap | 40 +++++++-------- .../containers/CommentContainer.spec.tsx | 2 +- .../comments/containers/CommentContainer.tsx | 26 +++++----- .../containers/LocalReplyListContainer.tsx | 12 ++--- .../containers/ReactionButtonContainer.tsx | 20 ++++---- .../containers/ReplyListContainer.spec.tsx | 6 +-- .../containers/ReplyListContainer.tsx | 50 +++++++++---------- .../containers/ReportButtonContainer.tsx | 18 +++---- .../containers/StreamContainer.spec.tsx | 4 +- .../comments/containers/StreamContainer.tsx | 20 ++++---- .../CommentContainer.spec.tsx.snap | 28 +++++------ .../ReplyListContainer.spec.tsx.snap | 12 ++--- .../StreamContainer.spec.tsx.snap | 8 +-- .../tabs/comments/queries/StreamQuery.tsx | 6 +-- .../components/ConversationThread.spec.tsx | 6 +-- .../components/ConversationThread.tsx | 14 +++--- .../components/PermalinkView.spec.tsx | 4 +- .../permalink/components/PermalinkView.tsx | 14 +++--- .../ConversationThread.spec.tsx.snap | 6 +-- .../__snapshots__/PermalinkView.spec.tsx.snap | 8 +-- .../ConversationThreadContainer.tsx | 16 +++--- .../containers/PermalinkViewContainer.tsx | 18 +++---- .../permalink/queries/PermalinkViewQuery.tsx | 6 +-- .../tabs/configure/components/Configure.tsx | 4 +- .../containers/ConfigureContainer.tsx | 12 ++--- .../tabs/configure/queries/ConfigureQuery.tsx | 8 +-- .../tabs/profile/components/Profile.spec.tsx | 2 +- .../tabs/profile/components/Profile.tsx | 8 +-- .../__snapshots__/Profile.spec.tsx.snap | 4 +- .../containers/CommentHistoryContainer.tsx | 16 +++--- .../profile/containers/ProfileContainer.tsx | 14 +++--- .../tabs/profile/queries/ProfileQuery.tsx | 8 +-- .../comments/charCountEditComment.spec.tsx | 2 +- .../comments/charCountPostComment.spec.tsx | 2 +- .../comments/charCountReplyComment.spec.tsx | 2 +- .../stream/test/comments/editComment.spec.tsx | 2 +- .../stream/test/comments/postComment.spec.tsx | 2 +- .../test/comments/postLocalReply.spec.tsx | 2 +- .../stream/test/comments/postReply.spec.tsx | 2 +- .../stream/test/comments/reaction.spec.tsx | 6 +-- .../test/comments/renderMessageBox.spec.tsx | 2 +- .../test/comments/reportComment.spec.tsx | 6 +-- .../test/configure/openOrCloseStream.spec.tsx | 2 +- .../test/configure/renderConfigure.spec.tsx | 2 +- .../configure/streamConfiguration.spec.tsx | 2 +- .../stream/test/profile/loadMore.spec.tsx | 2 +- .../test/profile/renderProfile.spec.tsx | 2 +- .../server/graph/tenant/resolvers/Comment.ts | 2 +- .../server/graph/tenant/resolvers/Query.ts | 2 +- .../server/graph/tenant/schema/schema.graphql | 8 +-- src/locales/en-US/admin.ftl | 2 +- 99 files changed, 406 insertions(+), 403 deletions(-) rename src/core/client/framework/helpers/{getMe.ts => getViewer.ts} (53%) rename src/core/client/framework/helpers/{getMeSourceID.ts => getViewerSourceID.ts} (83%) diff --git a/src/core/client/admin/components/App.spec.tsx b/src/core/client/admin/components/App.spec.tsx index 40a55c97e..acdc2c6cd 100644 --- a/src/core/client/admin/components/App.spec.tsx +++ b/src/core/client/admin/components/App.spec.tsx @@ -10,7 +10,7 @@ const AppN = removeFragmentRefs(App); it("renders correctly", () => { const props: PropTypesOf = { - me: {}, + viewer: {}, children: "child", }; const renderer = createRenderer(); diff --git a/src/core/client/admin/components/App.tsx b/src/core/client/admin/components/App.tsx index 048c9cc1d..300ba1932 100644 --- a/src/core/client/admin/components/App.tsx +++ b/src/core/client/admin/components/App.tsx @@ -12,11 +12,11 @@ import Version from "./Version"; import styles from "./App.css"; interface Props { - me: PropTypesOf["me"]; + viewer: PropTypesOf["viewer"]; children: React.ReactNode; } -const App: StatelessComponent = ({ children, me }) => ( +const App: StatelessComponent = ({ children, viewer }) => (
@@ -29,7 +29,7 @@ const App: StatelessComponent = ({ children, me }) => ( - + {children} diff --git a/src/core/client/admin/components/__snapshots__/App.spec.tsx.snap b/src/core/client/admin/components/__snapshots__/App.spec.tsx.snap index eb52415e7..32a0a8023 100644 --- a/src/core/client/admin/components/__snapshots__/App.spec.tsx.snap +++ b/src/core/client/admin/components/__snapshots__/App.spec.tsx.snap @@ -23,7 +23,7 @@ exports[`renders correctly 1`] = ` diff --git a/src/core/client/admin/containers/AppContainer.tsx b/src/core/client/admin/containers/AppContainer.tsx index ff29a6c5b..7693b19da 100644 --- a/src/core/client/admin/containers/AppContainer.tsx +++ b/src/core/client/admin/containers/AppContainer.tsx @@ -14,7 +14,7 @@ interface Props { class AppContainer extends React.Component { public render() { return ( - + {this.props.children} ); @@ -24,8 +24,8 @@ class AppContainer extends React.Component { const enhanced = withRouteConfig({ query: graphql` query AppContainerQuery { - me { - ...UserMenuContainer_me + viewer { + ...UserMenuContainer_viewer } } `, diff --git a/src/core/client/admin/containers/AuthCheckContainer.tsx b/src/core/client/admin/containers/AuthCheckContainer.tsx index cae232356..6af1c6c67 100644 --- a/src/core/client/admin/containers/AuthCheckContainer.tsx +++ b/src/core/client/admin/containers/AuthCheckContainer.tsx @@ -25,17 +25,17 @@ class AuthCheckContainer extends React.Component { } public componentWillReceiveProps(nextProps: Props) { - if (nextProps.data && nextProps.data.me) { + if (nextProps.data && nextProps.data.viewer) { this.wasLoggedIn = true; } this.redirectIfNotLoggedIn(nextProps, this.props); - if (nextProps.data && !nextProps.data.me) { + if (nextProps.data && !nextProps.data.viewer) { this.wasLoggedIn = false; } } private shouldRedirectTo(props: Props = this.props) { - if (!props.data || props.data.me) { + if (!props.data || props.data.viewer) { return false; } return true; @@ -43,16 +43,16 @@ class AuthCheckContainer extends React.Component { private hasAccess(props: Props = this.props) { const { - me, + viewer, settings: { auth }, } = props.data!; - if (me) { - if (me.role === "COMMENTER") { + if (viewer) { + if (viewer.role === "COMMENTER") { return false; } else if ( - !me.email || - !me.username || - (!me.profiles.some(p => p.__typename === "LocalProfile") && + !viewer.email || + !viewer.username || + (!viewer.profiles.some(p => p.__typename === "LocalProfile") && auth.integrations.local.enabled && (auth.integrations.local.targetFilter.admin || auth.integrations.local.targetFilter.stream)) @@ -88,15 +88,15 @@ class AuthCheckContainer extends React.Component { if (this.hasAccess()) { return this.props.children; } - return ; + return ; } } const enhanced = withRouteConfig({ query: graphql` query AuthCheckContainerQuery { - me { - ...RestrictedContainer_me + viewer { + ...RestrictedContainer_viewer username email profiles { diff --git a/src/core/client/admin/containers/RedirectLoginContainer.tsx b/src/core/client/admin/containers/RedirectLoginContainer.tsx index 475a28aad..cb5166a45 100644 --- a/src/core/client/admin/containers/RedirectLoginContainer.tsx +++ b/src/core/client/admin/containers/RedirectLoginContainer.tsx @@ -31,16 +31,16 @@ class RedirectLoginContainer extends React.Component { return null; } const { - me, + viewer, settings: { auth }, } = props.data!; - if (me) { - if (me.role === "COMMENTER") { + if (viewer) { + if (viewer.role === "COMMENTER") { return "/admin/login"; } else if ( - !me.email || - !me.username || - (!me.profiles.some(p => p.__typename === "LocalProfile") && + !viewer.email || + !viewer.username || + (!viewer.profiles.some(p => p.__typename === "LocalProfile") && auth.integrations.local.enabled && (auth.integrations.local.targetFilter.admin || auth.integrations.local.targetFilter.stream)) @@ -74,7 +74,7 @@ class RedirectLoginContainer extends React.Component { const enhanced = withRouteConfig({ query: graphql` query RedirectLoginContainerQuery { - me { + viewer { username email profiles { diff --git a/src/core/client/admin/containers/UserMenuContainer.tsx b/src/core/client/admin/containers/UserMenuContainer.tsx index 134fae771..809a451bd 100644 --- a/src/core/client/admin/containers/UserMenuContainer.tsx +++ b/src/core/client/admin/containers/UserMenuContainer.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { UserMenuContainer_me as MeData } from "talk-admin/__generated__/UserMenuContainer_me.graphql"; +import { UserMenuContainer_viewer as ViewerData } from "talk-admin/__generated__/UserMenuContainer_viewer.graphql"; import { graphql, withFragmentContainer } from "talk-framework/lib/relay"; import { SignOutMutation, withSignOutMutation } from "talk-framework/mutations"; @@ -8,7 +8,7 @@ import UserMenu from "../components/UserMenu"; interface Props { signOut: SignOutMutation; - me: MeData | null; + viewer: ViewerData | null; } class UserMenuContainer extends React.Component { @@ -17,7 +17,7 @@ class UserMenuContainer extends React.Component { return ( ); } @@ -25,8 +25,8 @@ class UserMenuContainer extends React.Component { const enhanced = withSignOutMutation( withFragmentContainer({ - me: graphql` - fragment UserMenuContainer_me on User { + viewer: graphql` + fragment UserMenuContainer_viewer on User { username } `, diff --git a/src/core/client/admin/routes/login/containers/AccountCompletionContainer.tsx b/src/core/client/admin/routes/login/containers/AccountCompletionContainer.tsx index f15a87055..33a1df920 100644 --- a/src/core/client/admin/routes/login/containers/AccountCompletionContainer.tsx +++ b/src/core/client/admin/routes/login/containers/AccountCompletionContainer.tsx @@ -3,7 +3,7 @@ import * as React from "react"; import { Component } from "react"; import { AccountCompletionContainer_auth as AuthData } from "talk-admin/__generated__/AccountCompletionContainer_auth.graphql"; -import { AccountCompletionContainer_me as UserData } from "talk-admin/__generated__/AccountCompletionContainer_me.graphql"; +import { AccountCompletionContainer_viewer as UserData } from "talk-admin/__generated__/AccountCompletionContainer_viewer.graphql"; import { AccountCompletionContainerLocal as Local } from "talk-admin/__generated__/AccountCompletionContainerLocal.graphql"; import { CompleteAccountMutation, @@ -24,28 +24,28 @@ type Props = { setAuthView: SetAuthViewMutation; local: Local; auth: AuthData; - me: UserData | null; + viewer: UserData | null; setRedirectPath: SetRedirectPathMutation; } & WithRouter; function handleAccountCompletion(props: Props) { const { local: { authView }, - me, + viewer, auth, setAuthView, } = props; - if (me) { - if (!me.email) { + if (viewer) { + if (!viewer.email) { if (authView !== "ADD_EMAIL_ADDRESS") { setAuthView({ view: "ADD_EMAIL_ADDRESS" }); } - } else if (!me.username) { + } else if (!viewer.username) { if (authView !== "CREATE_USERNAME") { setAuthView({ view: "CREATE_USERNAME" }); } } else if ( - !me.profiles.some(p => p.__typename === "LocalProfile") && + !viewer.profiles.some(p => p.__typename === "LocalProfile") && auth.integrations.local.enabled && (auth.integrations.local.targetFilter.admin || auth.integrations.local.targetFilter.stream) @@ -122,8 +122,8 @@ const enhanced = withLocalStateContainer( } } `, - me: graphql` - fragment AccountCompletionContainer_me on User { + viewer: graphql` + fragment AccountCompletionContainer_viewer on User { username email profiles { diff --git a/src/core/client/admin/routes/login/containers/LoginContainer.tsx b/src/core/client/admin/routes/login/containers/LoginContainer.tsx index 482523dc2..53a4585d2 100644 --- a/src/core/client/admin/routes/login/containers/LoginContainer.tsx +++ b/src/core/client/admin/routes/login/containers/LoginContainer.tsx @@ -26,7 +26,7 @@ class LoginContainer extends Component { return ( { const enhanced = withRouteConfig({ query: graphql` query LoginContainerQuery { - me { - ...AccountCompletionContainer_me + viewer { + ...AccountCompletionContainer_viewer } settings { auth { diff --git a/src/core/client/admin/test/auth/accountCompletion.spec.tsx b/src/core/client/admin/test/auth/accountCompletion.spec.tsx index e74e741ff..448215c11 100644 --- a/src/core/client/admin/test/auth/accountCompletion.spec.tsx +++ b/src/core/client/admin/test/auth/accountCompletion.spec.tsx @@ -25,12 +25,12 @@ async function createTestRenderer( settings: sinon .stub() .returns(merge({}, settings, get(customResolver, "Query.settings"))), - me: sinon + viewer: sinon .stub() .returns( merge( { ...users[0], email: "", username: "", profiles: [] }, - get(customResolver, "Query.me") + get(customResolver, "Query.viewer") ) ), }, @@ -63,7 +63,7 @@ it("renders addEmailAddress view", async () => { it("renders createUsername view", async () => { const { root } = await createTestRenderer({ Query: { - me: { + viewer: { email: "hans@test.com", }, }, @@ -74,7 +74,7 @@ it("renders createUsername view", async () => { it("renders createPassword view", async () => { const { root } = await createTestRenderer({ Query: { - me: { + viewer: { email: "hans@test.com", username: "hans", }, @@ -86,7 +86,7 @@ it("renders createPassword view", async () => { it("do not render createPassword view when local auth is disabled", async () => { await createTestRenderer({ Query: { - me: { + viewer: { email: "hans@test.com", username: "hans", }, @@ -112,7 +112,7 @@ it("do not render createPassword view when local auth is disabled", async () => it("complete account", async () => { await createTestRenderer({ Query: { - me: { + viewer: { email: "hans@test.com", username: "hans", profiles: [{ __typename: "LocalProfile" }], diff --git a/src/core/client/admin/test/auth/addEmailAddress.spec.tsx b/src/core/client/admin/test/auth/addEmailAddress.spec.tsx index ee1214d09..53eb1786b 100644 --- a/src/core/client/admin/test/auth/addEmailAddress.spec.tsx +++ b/src/core/client/admin/test/auth/addEmailAddress.spec.tsx @@ -25,7 +25,7 @@ async function createTestRenderer( settings: sinon .stub() .returns(merge({}, settings, get(customResolver, "Query.settings"))), - me: sinon.stub().returns({ ...users[0], email: "" }), + viewer: sinon.stub().returns({ ...users[0], email: "" }), }, }; diff --git a/src/core/client/admin/test/auth/createPassword.spec.tsx b/src/core/client/admin/test/auth/createPassword.spec.tsx index a55b30a76..b6c172f45 100644 --- a/src/core/client/admin/test/auth/createPassword.spec.tsx +++ b/src/core/client/admin/test/auth/createPassword.spec.tsx @@ -25,7 +25,7 @@ async function createTestRenderer( settings: sinon .stub() .returns(merge({}, settings, get(customResolver, "Query.settings"))), - me: sinon.stub().returns({ ...users[0], profiles: [] }), + viewer: sinon.stub().returns({ ...users[0], profiles: [] }), }, }; diff --git a/src/core/client/admin/test/auth/redirectLoggedIn.spec.tsx b/src/core/client/admin/test/auth/redirectLoggedIn.spec.tsx index 152d9260a..ed66ad76d 100644 --- a/src/core/client/admin/test/auth/redirectLoggedIn.spec.tsx +++ b/src/core/client/admin/test/auth/redirectLoggedIn.spec.tsx @@ -18,7 +18,7 @@ const resolvers = { settings: sinon.stub().returns(settings), moderationQueues: sinon.stub().returns(emptyModerationQueues), comments: sinon.stub().returns(emptyRejectedComments), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; diff --git a/src/core/client/admin/test/auth/restricted.spec.tsx b/src/core/client/admin/test/auth/restricted.spec.tsx index efabf69a2..d4e47f63f 100644 --- a/src/core/client/admin/test/auth/restricted.spec.tsx +++ b/src/core/client/admin/test/auth/restricted.spec.tsx @@ -31,7 +31,7 @@ function createTestRenderer( settings: sinon.stub().returns(settings), moderationQueues: sinon.stub().returns(emptyModerationQueues), comments: sinon.stub().returns(emptyRejectedComments), - me: sinon.stub().returns({ ...users[0], ...userDiff }), + viewer: sinon.stub().returns({ ...users[0], ...userDiff }), }, }; const { testRenderer, context } = create({ diff --git a/src/core/client/admin/test/auth/signOut.spec.tsx b/src/core/client/admin/test/auth/signOut.spec.tsx index 07bb4780c..92169f992 100644 --- a/src/core/client/admin/test/auth/signOut.spec.tsx +++ b/src/core/client/admin/test/auth/signOut.spec.tsx @@ -21,7 +21,7 @@ const resolvers = { settings: sinon.stub().returns(settings), moderationQueues: sinon.stub().returns(emptyModerationQueues), comments: sinon.stub().returns(emptyRejectedComments), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; diff --git a/src/core/client/admin/test/configure/advanced.spec.tsx b/src/core/client/admin/test/configure/advanced.spec.tsx index 66d2d1cb3..06ec1d02e 100644 --- a/src/core/client/admin/test/configure/advanced.spec.tsx +++ b/src/core/client/admin/test/configure/advanced.spec.tsx @@ -24,7 +24,7 @@ const createTestRenderer = async (resolver: any = {}) => { settings: sinon .stub() .returns(merge({}, settings, get(resolver, "Query.settings"))), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; const { testRenderer } = create({ diff --git a/src/core/client/admin/test/configure/auth.spec.tsx b/src/core/client/admin/test/configure/auth.spec.tsx index e5ad01107..11d1c45e2 100644 --- a/src/core/client/admin/test/configure/auth.spec.tsx +++ b/src/core/client/admin/test/configure/auth.spec.tsx @@ -28,7 +28,7 @@ const createTestRenderer = async (resolver: any = {}) => { .returns( merge({}, settingsWithEmptyAuth, get(resolver, "Query.settings")) ), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; const { testRenderer } = create({ diff --git a/src/core/client/admin/test/configure/general.spec.tsx b/src/core/client/admin/test/configure/general.spec.tsx index 8be09c72d..371f7f138 100644 --- a/src/core/client/admin/test/configure/general.spec.tsx +++ b/src/core/client/admin/test/configure/general.spec.tsx @@ -29,7 +29,7 @@ const createTestRenderer = async ( settings: sinon .stub() .returns(merge({}, settings, get(resolver, "Query.settings"))), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; const { testRenderer } = create({ diff --git a/src/core/client/admin/test/configure/moderation.spec.tsx b/src/core/client/admin/test/configure/moderation.spec.tsx index 43e573963..9e360631a 100644 --- a/src/core/client/admin/test/configure/moderation.spec.tsx +++ b/src/core/client/admin/test/configure/moderation.spec.tsx @@ -24,7 +24,7 @@ const createTestRenderer = async (resolver: any = {}) => { settings: sinon .stub() .returns(merge({}, settings, get(resolver, "Query.settings"))), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; const { testRenderer } = create({ diff --git a/src/core/client/admin/test/configure/organization.spec.tsx b/src/core/client/admin/test/configure/organization.spec.tsx index b7e2b368e..bfd2076c3 100644 --- a/src/core/client/admin/test/configure/organization.spec.tsx +++ b/src/core/client/admin/test/configure/organization.spec.tsx @@ -24,7 +24,7 @@ const createTestRenderer = async (resolver: any = {}) => { settings: sinon .stub() .returns(merge({}, settings, get(resolver, "Query.settings"))), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; const { testRenderer } = create({ diff --git a/src/core/client/admin/test/configure/wordList.spec.tsx b/src/core/client/admin/test/configure/wordList.spec.tsx index 15c18e45e..d2657d1f5 100644 --- a/src/core/client/admin/test/configure/wordList.spec.tsx +++ b/src/core/client/admin/test/configure/wordList.spec.tsx @@ -24,7 +24,7 @@ const createTestRenderer = async (resolver: any = {}) => { settings: sinon .stub() .returns(merge({}, settings, get(resolver, "Query.settings"))), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; const { testRenderer } = create({ diff --git a/src/core/client/admin/test/decisionHistory/decisionHistory.spec.tsx b/src/core/client/admin/test/decisionHistory/decisionHistory.spec.tsx index 39a817168..c1aa6ef8c 100644 --- a/src/core/client/admin/test/decisionHistory/decisionHistory.spec.tsx +++ b/src/core/client/admin/test/decisionHistory/decisionHistory.spec.tsx @@ -61,7 +61,7 @@ const createTestRenderer = async (resolver: any = {}) => { ...resolver, Query: { ...resolver.Query, - me: sinon.stub().returns({ + viewer: sinon.stub().returns({ ...users[0], commentModerationActionHistory, }), diff --git a/src/core/client/admin/test/moderate/moderate.spec.tsx b/src/core/client/admin/test/moderate/moderate.spec.tsx index 478a903ce..0aafe7a22 100644 --- a/src/core/client/admin/test/moderate/moderate.spec.tsx +++ b/src/core/client/admin/test/moderate/moderate.spec.tsx @@ -44,7 +44,7 @@ const createTestRenderer = async (resolver: any = {}) => { comments: get(resolver, "Query.comments") || sinon.stub().returns(emptyRejectedComments), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), }, }; const { testRenderer } = create({ diff --git a/src/core/client/admin/views/decisionHistory/containers/DecisionHistoryContainer.tsx b/src/core/client/admin/views/decisionHistory/containers/DecisionHistoryContainer.tsx index 4d3ec6774..f1b83ecb5 100644 --- a/src/core/client/admin/views/decisionHistory/containers/DecisionHistoryContainer.tsx +++ b/src/core/client/admin/views/decisionHistory/containers/DecisionHistoryContainer.tsx @@ -1,14 +1,14 @@ import React from "react"; import { graphql, RelayPaginationProp } from "react-relay"; -import { DecisionHistoryContainer_me as MeData } from "talk-admin/__generated__/DecisionHistoryContainer_me.graphql"; +import { DecisionHistoryContainer_viewer as ViewerData } from "talk-admin/__generated__/DecisionHistoryContainer_viewer.graphql"; import { DecisionHistoryContainerPaginationQueryVariables } from "talk-admin/__generated__/DecisionHistoryContainerPaginationQuery.graphql"; import { withPaginationContainer } from "talk-framework/lib/relay"; import DecisionHistory from "../components/DecisionHistory"; interface DecisionHistoryContainerProps { - me: MeData; + viewer: ViewerData; relay: RelayPaginationProp; onClosePopover: () => void; } @@ -21,7 +21,7 @@ export class DecisionHistoryContainer extends React.Component< }; public render() { - const actions = this.props.me.commentModerationActionHistory.edges.map( + const actions = this.props.viewer.commentModerationActionHistory.edges.map( edge => edge.node ); return ( @@ -65,8 +65,8 @@ const enhanced = withPaginationContainer< FragmentVariables >( { - me: graphql` - fragment DecisionHistoryContainer_me on User + viewer: graphql` + fragment DecisionHistoryContainer_viewer on User @argumentDefinitions( count: { type: "Int!", defaultValue: 5 } cursor: { type: "Cursor" } @@ -86,7 +86,7 @@ const enhanced = withPaginationContainer< { direction: "forward", getConnectionFromProps(props) { - return props.me && props.me.commentModerationActionHistory; + return props.viewer && props.viewer.commentModerationActionHistory; }, // This is also the default implementation of `getFragmentVariables` if it isn't provided. getFragmentVariables(prevVars, totalCount) { @@ -108,8 +108,8 @@ const enhanced = withPaginationContainer< $count: Int! $cursor: Cursor ) { - me { - ...DecisionHistoryContainer_me + viewer { + ...DecisionHistoryContainer_viewer @arguments(count: $count, cursor: $cursor) } } diff --git a/src/core/client/admin/views/decisionHistory/queries/DecisionHistoryQuery.tsx b/src/core/client/admin/views/decisionHistory/queries/DecisionHistoryQuery.tsx index 81238740b..38d6d1467 100644 --- a/src/core/client/admin/views/decisionHistory/queries/DecisionHistoryQuery.tsx +++ b/src/core/client/admin/views/decisionHistory/queries/DecisionHistoryQuery.tsx @@ -16,8 +16,8 @@ class DecisionHistoryQuery extends Component { query={graphql` query DecisionHistoryQuery { - me { - ...DecisionHistoryContainer_me + viewer { + ...DecisionHistoryContainer_viewer } } `} @@ -26,13 +26,13 @@ class DecisionHistoryQuery extends Component { if (error) { return
{error.message}
; } - if (!props || !props.me) { + if (!props || !props.viewer) { return ; } return ( ); diff --git a/src/core/client/admin/views/restricted/containers/RestrictedContainer.tsx b/src/core/client/admin/views/restricted/containers/RestrictedContainer.tsx index 370f3ba5c..20fd2885c 100644 --- a/src/core/client/admin/views/restricted/containers/RestrictedContainer.tsx +++ b/src/core/client/admin/views/restricted/containers/RestrictedContainer.tsx @@ -1,7 +1,7 @@ import { RouteProps } from "found"; import React, { Component } from "react"; -import { RestrictedContainer_me as MeData } from "talk-admin/__generated__/RestrictedContainer_me.graphql"; +import { RestrictedContainer_viewer as ViewerData } from "talk-admin/__generated__/RestrictedContainer_viewer.graphql"; import { SetRedirectPathMutation, withSetRedirectPathMutation, @@ -13,7 +13,7 @@ import { timeout } from "talk-common/utils"; import Restricted from "../components/Restricted"; interface Props { - me: MeData; + viewer: ViewerData; error?: Error | null; signOut: SignOutMutation; setRedirectPath: SetRedirectPathMutation; @@ -32,13 +32,13 @@ class RestrictedContainer extends Component { }; public render() { - if (!this.props.me) { + if (!this.props.viewer) { return null; } return ( ); @@ -46,8 +46,8 @@ class RestrictedContainer extends Component { } const enhanced = withFragmentContainer({ - me: graphql` - fragment RestrictedContainer_me on User { + viewer: graphql` + fragment RestrictedContainer_viewer on User { username } `, diff --git a/src/core/client/auth/containers/AccountCompletionContainer.tsx b/src/core/client/auth/containers/AccountCompletionContainer.tsx index 0e861518a..729302b28 100644 --- a/src/core/client/auth/containers/AccountCompletionContainer.tsx +++ b/src/core/client/auth/containers/AccountCompletionContainer.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { Component } from "react"; import { AccountCompletionContainer_auth as AuthData } from "talk-auth/__generated__/AccountCompletionContainer_auth.graphql"; -import { AccountCompletionContainer_me as UserData } from "talk-auth/__generated__/AccountCompletionContainer_me.graphql"; +import { AccountCompletionContainer_viewer as UserData } from "talk-auth/__generated__/AccountCompletionContainer_viewer.graphql"; import { AccountCompletionContainerLocal as Local } from "talk-auth/__generated__/AccountCompletionContainerLocal.graphql"; import { CompleteAccountMutation, @@ -21,32 +21,32 @@ interface Props { setView: SetViewMutation; local: Local; auth: AuthData; - me: UserData | null; + viewer: UserData | null; } function handleAccountCompletion(props: Props) { const { local: { view, accessToken }, - me, + viewer, auth, setView, completeAccount, } = props; - if (me) { - if (!me.email) { + if (viewer) { + if (!viewer.email) { if (view !== "ADD_EMAIL_ADDRESS") { setView({ view: "ADD_EMAIL_ADDRESS" }); } return false; } - if (!me.username) { + if (!viewer.username) { if (view !== "CREATE_USERNAME") { setView({ view: "CREATE_USERNAME" }); } return false; } if ( - !me.profiles.some(p => p.__typename === "LocalProfile") && + !viewer.profiles.some(p => p.__typename === "LocalProfile") && auth.integrations.local.enabled && auth.integrations.local.targetFilter.stream ) { @@ -109,8 +109,8 @@ const enhanced = withLocalStateContainer( } } `, - me: graphql` - fragment AccountCompletionContainer_me on User { + viewer: graphql` + fragment AccountCompletionContainer_viewer on User { username email profiles { diff --git a/src/core/client/auth/containers/AppContainer.tsx b/src/core/client/auth/containers/AppContainer.tsx index bde19de93..da814b136 100644 --- a/src/core/client/auth/containers/AppContainer.tsx +++ b/src/core/client/auth/containers/AppContainer.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { Component } from "react"; import { AppContainer_auth as AuthData } from "talk-auth/__generated__/AppContainer_auth.graphql"; -import { AppContainer_me as UserData } from "talk-auth/__generated__/AppContainer_me.graphql"; +import { AppContainer_viewer as UserData } from "talk-auth/__generated__/AppContainer_viewer.graphql"; import { AppContainerLocal as Local } from "talk-auth/__generated__/AppContainerLocal.graphql"; import { graphql, @@ -16,7 +16,7 @@ import AccountCompletionContainer from "./AccountCompletionContainer"; interface Props { local: Local; auth: AuthData; - me: UserData | null; + viewer: UserData | null; } class AppContainer extends Component { @@ -24,10 +24,10 @@ class AppContainer extends Component { const { local: { view }, auth, - me, + viewer, } = this.props; return ( - + ); @@ -49,9 +49,9 @@ const enhanced = withLocalStateContainer( ...AccountCompletionContainer_auth } `, - me: graphql` - fragment AppContainer_me on User { - ...AccountCompletionContainer_me + viewer: graphql` + fragment AppContainer_viewer on User { + ...AccountCompletionContainer_viewer } `, })(AppContainer) diff --git a/src/core/client/auth/queries/AppQuery.tsx b/src/core/client/auth/queries/AppQuery.tsx index 703d605e0..61a2d7b4e 100644 --- a/src/core/client/auth/queries/AppQuery.tsx +++ b/src/core/client/auth/queries/AppQuery.tsx @@ -11,8 +11,8 @@ export default class AppQuery extends Component { query={graphql` query AppQuery { - me { - ...AppContainer_me + viewer { + ...AppContainer_viewer } settings { auth { @@ -29,7 +29,9 @@ export default class AppQuery extends Component { if (!props) { return null; } - return ; + return ( + + ); }} /> ); diff --git a/src/core/client/auth/test/accountCompletion.spec.tsx b/src/core/client/auth/test/accountCompletion.spec.tsx index 892211c3a..11d1874db 100644 --- a/src/core/client/auth/test/accountCompletion.spec.tsx +++ b/src/core/client/auth/test/accountCompletion.spec.tsx @@ -27,10 +27,10 @@ async function createTestRenderer( settings: sinon .stub() .returns(merge({}, settings, get(customResolver, "Query.settings"))), - me: sinon + viewer: sinon .stub() .returns( - merge({ id: "me", profiles: [] }, get(customResolver, "Query.me")) + merge({ id: "me", profiles: [] }, get(customResolver, "Query.viewer")) ), }, }; @@ -72,7 +72,7 @@ it("renders addEmailAddress view", async () => { it("renders createUsername view", async () => { const { root } = await createTestRenderer({ Query: { - me: { + viewer: { email: "hans@test.com", }, }, @@ -85,7 +85,7 @@ it("renders createUsername view", async () => { it("renders createPassword view", async () => { const { root } = await createTestRenderer({ Query: { - me: { + viewer: { email: "hans@test.com", username: "hans", }, @@ -99,7 +99,7 @@ it("renders createPassword view", async () => { it("do not render createPassword view when local auth is disabled", async () => { await createTestRenderer({ Query: { - me: { + viewer: { email: "hans@test.com", username: "hans", }, @@ -121,7 +121,7 @@ it("do not render createPassword view when local auth is disabled", async () => it("send back auth token", async () => { const { context } = await createTestRenderer({ Query: { - me: { + viewer: { email: "hans@test.com", username: "hans", profiles: [{ __typename: "LocalProfile" }], diff --git a/src/core/client/framework/helpers/getMe.ts b/src/core/client/framework/helpers/getViewer.ts similarity index 53% rename from src/core/client/framework/helpers/getMe.ts rename to src/core/client/framework/helpers/getViewer.ts index f10500db0..f12754693 100644 --- a/src/core/client/framework/helpers/getMe.ts +++ b/src/core/client/framework/helpers/getViewer.ts @@ -1,12 +1,12 @@ import { Environment } from "relay-runtime"; -import getMeSourceID from "./getMeSourceID"; +import getViewerSourceID from "./getViewerSourceID"; export default function getMe(environment: Environment) { const source = environment.getStore().getSource(); - const meID = getMeSourceID(environment); - if (!meID) { + const viewerID = getViewerSourceID(environment); + if (!viewerID) { return null; } - return source.get(meID)!; + return source.get(viewerID)!; } diff --git a/src/core/client/framework/helpers/getMeSourceID.ts b/src/core/client/framework/helpers/getViewerSourceID.ts similarity index 83% rename from src/core/client/framework/helpers/getMeSourceID.ts rename to src/core/client/framework/helpers/getViewerSourceID.ts index 0bb386ae4..9c3df7099 100644 --- a/src/core/client/framework/helpers/getMeSourceID.ts +++ b/src/core/client/framework/helpers/getViewerSourceID.ts @@ -3,8 +3,8 @@ import { Environment, ROOT_ID } from "relay-runtime"; export default function getMeSourceID(environment: Environment): string | null { const source = environment.getStore().getSource(); const root = source.get(ROOT_ID)!; - if (!root.me) { + if (!root.viewer) { return null; } - return root.me.__ref; + return root.viewer.__ref; } diff --git a/src/core/client/framework/helpers/index.ts b/src/core/client/framework/helpers/index.ts index 7589dbe00..8effa12d5 100644 --- a/src/core/client/framework/helpers/index.ts +++ b/src/core/client/framework/helpers/index.ts @@ -1,5 +1,5 @@ -export { default as getMe } from "./getMe"; -export { default as getMeSourceID } from "./getMeSourceID"; +export { default as getViewer } from "./getViewer"; +export { default as getMeSourceID } from "./getViewerSourceID"; export { default as getURLWithCommentID } from "./getURLWithCommentID"; export { default as urls } from "./urls"; export { default as createContextHOC } from "./createContextHOC"; diff --git a/src/core/client/stream/containers/TabBarContainer.tsx b/src/core/client/stream/containers/TabBarContainer.tsx index ade06eb13..f1c304256 100644 --- a/src/core/client/stream/containers/TabBarContainer.tsx +++ b/src/core/client/stream/containers/TabBarContainer.tsx @@ -7,8 +7,8 @@ import { withLocalStateContainer, } from "talk-framework/lib/relay"; -import { TabBarContainer_me as MeData } from "talk-stream/__generated__/TabBarContainer_me.graphql"; import { TabBarContainer_story as StoryData } from "talk-stream/__generated__/TabBarContainer_story.graphql"; +import { TabBarContainer_viewer as ViewerData } from "talk-stream/__generated__/TabBarContainer_viewer.graphql"; import { TabBarContainerLocal as Local } from "talk-stream/__generated__/TabBarContainerLocal.graphql"; import { roleIsAtLeast } from "talk-stream/helpers"; import { @@ -21,7 +21,7 @@ import TabBar from "../components/TabBar"; interface Props { story: StoryData | null; - me: MeData | null; + viewer: ViewerData | null; local: Local; setActiveTab: SetActiveTabMutation; } @@ -44,7 +44,8 @@ export class TabBarContainer extends Component { commentCount={commentCount} showProfileTab={loggedIn} showConfigureTab={ - !!this.props.me && roleIsAtLeast(this.props.me.role, "MODERATOR") + !!this.props.viewer && + roleIsAtLeast(this.props.viewer.role, "MODERATOR") } onTabClick={this.handleSetActiveTab} /> @@ -62,8 +63,8 @@ const enhanced = withSetActiveTabMutation( ` )( withFragmentContainer({ - me: graphql` - fragment TabBarContainer_me on User { + viewer: graphql` + fragment TabBarContainer_viewer on User { role } `, diff --git a/src/core/client/stream/containers/UserBoxContainer.spec.tsx b/src/core/client/stream/containers/UserBoxContainer.spec.tsx index b942078dd..4860a74c8 100644 --- a/src/core/client/stream/containers/UserBoxContainer.spec.tsx +++ b/src/core/client/stream/containers/UserBoxContainer.spec.tsx @@ -19,7 +19,7 @@ it("renders fully", () => { }, accessTokenJTI: "JTI", }, - me: null, + viewer: null, settings: { auth: { integrations: { @@ -76,7 +76,7 @@ it("renders without logout button", () => { }, accessTokenJTI: null, }, - me: null, + viewer: null, settings: { auth: { integrations: { @@ -133,7 +133,7 @@ it("renders sso only", () => { }, accessTokenJTI: "JTI", }, - me: null, + viewer: null, settings: { auth: { integrations: { @@ -190,7 +190,7 @@ it("renders sso only without logout button", () => { }, accessTokenJTI: "JTI", }, - me: null, + viewer: null, settings: { auth: { integrations: { @@ -247,7 +247,7 @@ it("renders without register button", () => { }, accessTokenJTI: "JTI", }, - me: null, + viewer: null, settings: { auth: { integrations: { diff --git a/src/core/client/stream/containers/UserBoxContainer.tsx b/src/core/client/stream/containers/UserBoxContainer.tsx index b769a1074..e4f9c89dd 100644 --- a/src/core/client/stream/containers/UserBoxContainer.tsx +++ b/src/core/client/stream/containers/UserBoxContainer.tsx @@ -7,8 +7,8 @@ import { withLocalStateContainer, } from "talk-framework/lib/relay"; import { SignOutMutation, withSignOutMutation } from "talk-framework/mutations"; -import { UserBoxContainer_me as MeData } from "talk-stream/__generated__/UserBoxContainer_me.graphql"; import { UserBoxContainer_settings as SettingsData } from "talk-stream/__generated__/UserBoxContainer_settings.graphql"; +import { UserBoxContainer_viewer as ViewerData } from "talk-stream/__generated__/UserBoxContainer_viewer.graphql"; import { UserBoxContainerLocal as Local } from "talk-stream/__generated__/UserBoxContainerLocal.graphql"; import UserBoxUnauthenticated from "talk-stream/components/UserBoxUnauthenticated"; import { @@ -24,7 +24,7 @@ import UserBoxAuthenticated from "../components/UserBoxAuthenticated"; interface Props { local: Local; - me: MeData | null; + viewer: ViewerData | null; settings: SettingsData; showAuthPopup: ShowAuthPopupMutation; setAuthPopupState: SetAuthPopupStateMutation; @@ -68,14 +68,14 @@ export class UserBoxContainer extends Component { local: { authPopup: { open, focus, view }, }, - me, + viewer, } = this.props; - if (me) { + if (viewer) { return ( ); @@ -125,8 +125,8 @@ const enhanced = withSignOutMutation( ` )( withFragmentContainer({ - me: graphql` - fragment UserBoxContainer_me on User { + viewer: graphql` + fragment UserBoxContainer_viewer on User { username } `, diff --git a/src/core/client/stream/mutations/CreateCommentDontAgreeMutation.ts b/src/core/client/stream/mutations/CreateCommentDontAgreeMutation.ts index ab6485375..0339481f2 100644 --- a/src/core/client/stream/mutations/CreateCommentDontAgreeMutation.ts +++ b/src/core/client/stream/mutations/CreateCommentDontAgreeMutation.ts @@ -20,7 +20,7 @@ const mutation = graphql` createCommentDontAgree(input: $input) { comment { id - myActionPresence { + viewerActionPresence { dontAgree } } diff --git a/src/core/client/stream/mutations/CreateCommentFlagMutation.ts b/src/core/client/stream/mutations/CreateCommentFlagMutation.ts index f06d137dd..a35f4f105 100644 --- a/src/core/client/stream/mutations/CreateCommentFlagMutation.ts +++ b/src/core/client/stream/mutations/CreateCommentFlagMutation.ts @@ -18,7 +18,7 @@ const mutation = graphql` createCommentFlag(input: $input) { comment { id - myActionPresence { + viewerActionPresence { flag } } diff --git a/src/core/client/stream/mutations/CreateCommentMutation.ts b/src/core/client/stream/mutations/CreateCommentMutation.ts index 69a379ac2..4fb8eea59 100644 --- a/src/core/client/stream/mutations/CreateCommentMutation.ts +++ b/src/core/client/stream/mutations/CreateCommentMutation.ts @@ -6,7 +6,7 @@ import { RecordSourceSelectorProxy, } from "relay-runtime"; -import { getMe, getStorySettings } from "talk-framework/helpers"; +import { getStorySettings, getViewer } from "talk-framework/helpers"; import { TalkContext } from "talk-framework/lib/bootstrap"; import { commitMutationPromiseNormalized, @@ -78,7 +78,7 @@ graphql` moderation } } - fragment CreateCommentMutation_me on User { + fragment CreateCommentMutation_viewer on User { role } `; @@ -106,7 +106,7 @@ function commit( input: CreateCommentInput, { uuidGenerator, relayEnvironment }: TalkContext ) { - const me = getMe(environment)!; + const me = getViewer(environment)!; const currentDate = new Date().toISOString(); const id = uuidGenerator(); diff --git a/src/core/client/stream/mutations/CreateCommentReactionMutation.ts b/src/core/client/stream/mutations/CreateCommentReactionMutation.ts index 371230a1d..90b6b6282 100644 --- a/src/core/client/stream/mutations/CreateCommentReactionMutation.ts +++ b/src/core/client/stream/mutations/CreateCommentReactionMutation.ts @@ -44,7 +44,7 @@ function commit(environment: Environment, input: CreateCommentReactionInput) { createCommentReaction: { comment: { id: input.commentID, - myActionPresence: { + viewerActionPresence: { reaction: true, }, actionCounts: { diff --git a/src/core/client/stream/mutations/CreateCommentReplyMutation.ts b/src/core/client/stream/mutations/CreateCommentReplyMutation.ts index a0e272781..b99050192 100644 --- a/src/core/client/stream/mutations/CreateCommentReplyMutation.ts +++ b/src/core/client/stream/mutations/CreateCommentReplyMutation.ts @@ -6,7 +6,7 @@ import { RecordSourceSelectorProxy, } from "relay-runtime"; -import { getMe, getStorySettings } from "talk-framework/helpers"; +import { getStorySettings, getViewer } from "talk-framework/helpers"; import { TalkContext } from "talk-framework/lib/bootstrap"; import { commitMutationPromiseNormalized, @@ -106,7 +106,7 @@ graphql` moderation } } - fragment CreateCommentReplyMutation_me on User { + fragment CreateCommentReplyMutation_viewer on User { role } `; @@ -133,7 +133,7 @@ function commit( input: CreateCommentReplyInput, { uuidGenerator, relayEnvironment }: TalkContext ) { - const me = getMe(environment)!; + const viewer = getViewer(environment)!; const currentDate = new Date().toISOString(); const id = uuidGenerator(); @@ -144,7 +144,7 @@ function commit( // TODO: Generate and use schema types. const expectPremoderation = - !roleIsAtLeast(me.role, "STAFF") && storySettings.moderation === "PRE"; + !roleIsAtLeast(viewer.role, "STAFF") && storySettings.moderation === "PRE"; return commitMutationPromiseNormalized(environment, { mutation, @@ -166,8 +166,8 @@ function commit( createdAt: currentDate, status: "NONE", author: { - id: me.id, - username: me.username, + id: viewer.id, + username: viewer.username, }, body: input.body, editing: { diff --git a/src/core/client/stream/mutations/RemoveCommentReactionMutation.ts b/src/core/client/stream/mutations/RemoveCommentReactionMutation.ts index 74d7dfd6c..d57278b04 100644 --- a/src/core/client/stream/mutations/RemoveCommentReactionMutation.ts +++ b/src/core/client/stream/mutations/RemoveCommentReactionMutation.ts @@ -43,7 +43,7 @@ function commit(environment: Environment, input: RemoveCommentReactionInput) { removeCommentReaction: { comment: { id: input.commentID, - myActionPresence: { + viewerActionPresence: { reaction: false, }, actionCounts: { diff --git a/src/core/client/stream/queries/TabBarQuery.tsx b/src/core/client/stream/queries/TabBarQuery.tsx index fc1d41384..7e265a160 100644 --- a/src/core/client/stream/queries/TabBarQuery.tsx +++ b/src/core/client/stream/queries/TabBarQuery.tsx @@ -21,8 +21,8 @@ class TabBarQuery extends Component { query={graphql` query TabBarQuery($storyID: ID, $storyURL: String) { - me { - ...TabBarContainer_me + viewer { + ...TabBarContainer_viewer } story(id: $storyID, url: $storyURL) { ...TabBarContainer_story @@ -40,7 +40,7 @@ class TabBarQuery extends Component { return ( ); diff --git a/src/core/client/stream/tabs/comments/components/ReplyList.spec.tsx b/src/core/client/stream/tabs/comments/components/ReplyList.spec.tsx index 4d9afb095..9ab0b6e6e 100644 --- a/src/core/client/stream/tabs/comments/components/ReplyList.spec.tsx +++ b/src/core/client/stream/tabs/comments/components/ReplyList.spec.tsx @@ -22,7 +22,7 @@ it("renders correctly", () => { hasMore: false, disableShowAll: false, indentLevel: 1, - me: null, + viewer: null, localReply: false, disableReplies: false, settings: { @@ -45,7 +45,7 @@ describe("when there is more", () => { hasMore: true, disableShowAll: false, indentLevel: 1, - me: null, + viewer: null, settings: { reaction: { icon: "thumb_up_alt", diff --git a/src/core/client/stream/tabs/comments/components/ReplyList.tsx b/src/core/client/stream/tabs/comments/components/ReplyList.tsx index 50055c213..3124a6ac2 100644 --- a/src/core/client/stream/tabs/comments/components/ReplyList.tsx +++ b/src/core/client/stream/tabs/comments/components/ReplyList.tsx @@ -10,7 +10,7 @@ import Indent from "./Indent"; export interface ReplyListProps { story: PropTypesOf["story"]; - me: PropTypesOf["me"]; + viewer: PropTypesOf["viewer"]; comment: { id: string; }; @@ -41,7 +41,7 @@ const ReplyList: StatelessComponent = props => { { onLoadMore: noop, disableLoadMore: false, hasMore: false, - me: null, + viewer: null, orderBy: "CREATED_AT_ASC", onChangeOrderBy: noop, }; @@ -45,7 +45,7 @@ describe("when use is logged in", () => { onLoadMore: noop, disableLoadMore: false, hasMore: false, - me: {}, + viewer: {}, settings: { reaction: { icon: "thumb_up_alt", @@ -76,7 +76,7 @@ describe("when there is more", () => { onLoadMore: sinon.spy(), disableLoadMore: false, hasMore: true, - me: null, + viewer: null, orderBy: "CREATED_AT_ASC", onChangeOrderBy: noop, }; diff --git a/src/core/client/stream/tabs/comments/components/Stream.tsx b/src/core/client/stream/tabs/comments/components/Stream.tsx index bb7ab8548..2a1f0e709 100644 --- a/src/core/client/stream/tabs/comments/components/Stream.tsx +++ b/src/core/client/stream/tabs/comments/components/Stream.tsx @@ -33,10 +33,10 @@ export interface StreamProps { onLoadMore?: () => void; hasMore?: boolean; disableLoadMore?: boolean; - me: - | PropTypesOf["me"] & - PropTypesOf["me"] & - PropTypesOf["me"] + viewer: + | PropTypesOf["viewer"] & + PropTypesOf["viewer"] & + PropTypesOf["viewer"] | null; orderBy: PropTypesOf["orderBy"]; onChangeOrderBy: (e: React.ChangeEvent) => void; @@ -46,7 +46,7 @@ export interface StreamProps { const Stream: StatelessComponent = props => { return ( - + {props.comments.length > 0 && ( @@ -63,14 +63,14 @@ const Stream: StatelessComponent = props => { {props.comments.map(comment => ( diff --git a/src/core/client/stream/tabs/comments/components/__snapshots__/ReplyList.spec.tsx.snap b/src/core/client/stream/tabs/comments/components/__snapshots__/ReplyList.spec.tsx.snap index c7043fb0b..cdc821b7b 100644 --- a/src/core/client/stream/tabs/comments/components/__snapshots__/ReplyList.spec.tsx.snap +++ b/src/core/client/stream/tabs/comments/components/__snapshots__/ReplyList.spec.tsx.snap @@ -19,7 +19,6 @@ exports[`renders correctly 1`] = ` indentLevel={1} key="comment-1" localReply={false} - me={null} settings={ Object { "reaction": Object { @@ -34,6 +33,7 @@ exports[`renders correctly 1`] = ` "id": "story-id", } } + viewer={null} /> @@ -87,7 +87,6 @@ exports[`when there is more disables load more button 1`] = ` } indentLevel={1} key="comment-1" - me={null} settings={ Object { "reaction": Object { @@ -102,6 +101,7 @@ exports[`when there is more disables load more button 1`] = ` "id": "story-id", } } + viewer={null} /> @@ -158,7 +158,6 @@ exports[`when there is more disables load more button 1`] = ` size="double" > diff --git a/src/core/client/stream/tabs/comments/containers/CommentContainer.spec.tsx b/src/core/client/stream/tabs/comments/containers/CommentContainer.spec.tsx index b90c37cf8..174714404 100644 --- a/src/core/client/stream/tabs/comments/containers/CommentContainer.spec.tsx +++ b/src/core/client/stream/tabs/comments/containers/CommentContainer.spec.tsx @@ -16,7 +16,7 @@ function createDefaultProps(add: DeepPartial = {}): Props { return merge( {}, { - me: null, + viewer: null, story: { url: "http://localhost/story", isClosed: false, diff --git a/src/core/client/stream/tabs/comments/containers/CommentContainer.tsx b/src/core/client/stream/tabs/comments/containers/CommentContainer.tsx index 2ae25cdaa..2598fdd95 100644 --- a/src/core/client/stream/tabs/comments/containers/CommentContainer.tsx +++ b/src/core/client/stream/tabs/comments/containers/CommentContainer.tsx @@ -7,9 +7,9 @@ import { getURLWithCommentID } from "talk-framework/helpers"; import withFragmentContainer from "talk-framework/lib/relay/withFragmentContainer"; import { PropTypesOf } from "talk-framework/types"; import { CommentContainer_comment as CommentData } from "talk-stream/__generated__/CommentContainer_comment.graphql"; -import { CommentContainer_me as MeData } from "talk-stream/__generated__/CommentContainer_me.graphql"; import { CommentContainer_settings as SettingsData } from "talk-stream/__generated__/CommentContainer_settings.graphql"; import { CommentContainer_story as StoryData } from "talk-stream/__generated__/CommentContainer_story.graphql"; +import { CommentContainer_viewer as ViewerData } from "talk-stream/__generated__/CommentContainer_viewer.graphql"; import { SetCommentIDMutation, ShowAuthPopupMutation, @@ -32,7 +32,7 @@ import ReplyCommentFormContainer from "./ReplyCommentFormContainer"; import ReportButtonContainer from "./ReportButtonContainer"; interface Props { - me: MeData | null; + viewer: ViewerData | null; comment: CommentData; story: StoryData; settings: SettingsData; @@ -79,9 +79,9 @@ export class CommentContainer extends Component { private isEditable() { const isMyComment = !!( - this.props.me && + this.props.viewer && this.props.comment.author && - this.props.me.id === this.props.comment.author.id + this.props.viewer.id === this.props.comment.author.id ); return ( isMyComment && isBeforeDate(this.props.comment.editing.editableUntil) @@ -89,7 +89,7 @@ export class CommentContainer extends Component { } private openReplyDialog = () => { - if (this.props.me) { + if (this.props.viewer) { this.setState(state => ({ showReplyDialog: true, })); @@ -99,7 +99,7 @@ export class CommentContainer extends Component { }; private openEditDialog = () => { - if (this.props.me) { + if (this.props.viewer) { this.setState(state => ({ showEditDialog: true, })); @@ -145,7 +145,7 @@ export class CommentContainer extends Component { disableReplies, showConversationLink, highlight, - me, + viewer, } = this.props; const { showReplyDialog, showEditDialog, editable } = this.state; if (showEditDialog) { @@ -219,11 +219,11 @@ export class CommentContainer extends Component { - + {showConversationLink && ( @@ -259,11 +259,11 @@ export class CommentContainer extends Component { const enhanced = withSetCommentIDMutation( withShowAuthPopupMutation( withFragmentContainer({ - me: graphql` - fragment CommentContainer_me on User { + viewer: graphql` + fragment CommentContainer_viewer on User { id - ...ReactionButtonContainer_me - ...ReportButtonContainer_me + ...ReactionButtonContainer_viewer + ...ReportButtonContainer_viewer } `, story: graphql` diff --git a/src/core/client/stream/tabs/comments/containers/LocalReplyListContainer.tsx b/src/core/client/stream/tabs/comments/containers/LocalReplyListContainer.tsx index 71f7f8204..a841021c7 100644 --- a/src/core/client/stream/tabs/comments/containers/LocalReplyListContainer.tsx +++ b/src/core/client/stream/tabs/comments/containers/LocalReplyListContainer.tsx @@ -4,15 +4,15 @@ import { graphql } from "react-relay"; import withFragmentContainer from "talk-framework/lib/relay/withFragmentContainer"; import { PropTypesOf } from "talk-framework/types"; import { LocalReplyListContainer_comment as CommentData } from "talk-stream/__generated__/LocalReplyListContainer_comment.graphql"; -import { LocalReplyListContainer_me as MeData } from "talk-stream/__generated__/LocalReplyListContainer_me.graphql"; import { LocalReplyListContainer_settings as SettingsData } from "talk-stream/__generated__/LocalReplyListContainer_settings.graphql"; import { LocalReplyListContainer_story as StoryData } from "talk-stream/__generated__/LocalReplyListContainer_story.graphql"; +import { LocalReplyListContainer_viewer as ViewerData } from "talk-stream/__generated__/LocalReplyListContainer_viewer.graphql"; import ReplyList from "../components/ReplyList"; interface Props { indentLevel: number; - me: MeData; + viewer: ViewerData; story: StoryData; comment: CommentData; settings: SettingsData; @@ -31,7 +31,7 @@ export class LocalReplyListContainer extends Component { } return ( { } const enhanced = withFragmentContainer({ - me: graphql` - fragment LocalReplyListContainer_me on User { - ...CommentContainer_me + viewer: graphql` + fragment LocalReplyListContainer_viewer on User { + ...CommentContainer_viewer } `, story: graphql` diff --git a/src/core/client/stream/tabs/comments/containers/ReactionButtonContainer.tsx b/src/core/client/stream/tabs/comments/containers/ReactionButtonContainer.tsx index 9a0413a21..5d1ce4e1a 100644 --- a/src/core/client/stream/tabs/comments/containers/ReactionButtonContainer.tsx +++ b/src/core/client/stream/tabs/comments/containers/ReactionButtonContainer.tsx @@ -2,8 +2,8 @@ import React from "react"; import { graphql } from "react-relay"; import { withFragmentContainer } from "talk-framework/lib/relay"; import { ReactionButtonContainer_comment as CommentData } from "talk-stream/__generated__/ReactionButtonContainer_comment.graphql"; -import { ReactionButtonContainer_me as MeData } from "talk-stream/__generated__/ReactionButtonContainer_me.graphql"; import { ReactionButtonContainer_settings as SettingsData } from "talk-stream/__generated__/ReactionButtonContainer_settings.graphql"; +import { ReactionButtonContainer_viewer as ViewerData } from "talk-stream/__generated__/ReactionButtonContainer_viewer.graphql"; import { CreateCommentReactionMutation, @@ -23,7 +23,7 @@ interface ReactionButtonContainerProps { removeCommentReaction: RemoveCommentReactionMutation; comment: CommentData; settings: SettingsData; - me: MeData | null; + viewer: ViewerData | null; showAuthPopup: ShowAuthPopupMutation; } @@ -33,7 +33,7 @@ class ReactionButtonContainer extends React.Component< private handleSignIn = () => this.props.showAuthPopup({ view: "SIGN_IN" }); private handleClick = () => { - if (this.props.me === null) { + if (this.props.viewer === null) { return this.handleSignIn(); } @@ -44,8 +44,8 @@ class ReactionButtonContainer extends React.Component< const { createCommentReaction, removeCommentReaction } = this.props; const reacted = - this.props.comment.myActionPresence && - this.props.comment.myActionPresence.reaction; + this.props.comment.viewerActionPresence && + this.props.comment.viewerActionPresence.reaction; return reacted ? removeCommentReaction(input) @@ -63,8 +63,8 @@ class ReactionButtonContainer extends React.Component< } = this.props.settings; const reacted = - this.props.comment.myActionPresence && - this.props.comment.myActionPresence.reaction; + this.props.comment.viewerActionPresence && + this.props.comment.viewerActionPresence.reaction; return ( ({ - me: graphql` - fragment ReactionButtonContainer_me on User { + viewer: graphql` + fragment ReactionButtonContainer_viewer on User { id } `, @@ -95,7 +95,7 @@ export default withShowAuthPopupMutation( revision { id } - myActionPresence { + viewerActionPresence { reaction } actionCounts { diff --git a/src/core/client/stream/tabs/comments/containers/ReplyListContainer.spec.tsx b/src/core/client/stream/tabs/comments/containers/ReplyListContainer.spec.tsx index 50eacfcd9..a98c5fd06 100644 --- a/src/core/client/stream/tabs/comments/containers/ReplyListContainer.spec.tsx +++ b/src/core/client/stream/tabs/comments/containers/ReplyListContainer.spec.tsx @@ -33,7 +33,7 @@ it("renders correctly", () => { hasMore: noop, isLoading: noop, } as any, - me: null, + viewer: null, indentLevel: 1, ReplyListComponent: () => null, localReply: false, @@ -56,7 +56,7 @@ it("renders correctly when replies are empty", () => { hasMore: noop, isLoading: noop, } as any, - me: null, + viewer: null, settings: { reaction: { icon: "thumb_up_alt", @@ -95,7 +95,7 @@ describe("when has more replies", () => { isLoading: () => false, loadMore: (_: any, callback: () => void) => (finishLoading = callback), } as any, - me: null, + viewer: null, indentLevel: 1, ReplyListComponent: undefined, localReply: false, diff --git a/src/core/client/stream/tabs/comments/containers/ReplyListContainer.tsx b/src/core/client/stream/tabs/comments/containers/ReplyListContainer.tsx index ecfa729b2..08c4fd6c8 100644 --- a/src/core/client/stream/tabs/comments/containers/ReplyListContainer.tsx +++ b/src/core/client/stream/tabs/comments/containers/ReplyListContainer.tsx @@ -5,9 +5,9 @@ import { withProps } from "recompose"; import { withPaginationContainer } from "talk-framework/lib/relay"; import { PropTypesOf } from "talk-framework/types"; import { ReplyListContainer1_comment as CommentData } from "talk-stream/__generated__/ReplyListContainer1_comment.graphql"; -import { ReplyListContainer1_me as MeData } from "talk-stream/__generated__/ReplyListContainer1_me.graphql"; import { ReplyListContainer1_settings as SettingsData } from "talk-stream/__generated__/ReplyListContainer1_settings.graphql"; import { ReplyListContainer1_story as StoryData } from "talk-stream/__generated__/ReplyListContainer1_story.graphql"; +import { ReplyListContainer1_viewer as ViewerData } from "talk-stream/__generated__/ReplyListContainer1_viewer.graphql"; import { COMMENT_SORT, ReplyListContainer1PaginationQueryVariables, @@ -24,7 +24,7 @@ type UnpackArray = T extends ReadonlyArray ? U : any; type ReplyNode5 = UnpackArray["node"]; interface BaseProps { - me: MeData | null; + viewer: ViewerData | null; story: StoryData; comment: CommentData; settings: SettingsData; @@ -68,7 +68,7 @@ export class ReplyListContainer extends React.Component { ...edge.node, replyListElement: this.props.ReplyListComponent && ( { })); return ( { function createReplyListContainer( indentLevel: number, fragments: { - me: GraphQLTaggedNode; + viewer: GraphQLTaggedNode; story: GraphQLTaggedNode; comment: GraphQLTaggedNode; settings: GraphQLTaggedNode; @@ -165,10 +165,10 @@ const LastReplyList: StatelessComponent< const ReplyListContainer5 = createReplyListContainer( 5, { - me: graphql` - fragment ReplyListContainer5_me on User { - ...CommentContainer_me - ...LocalReplyListContainer_me + viewer: graphql` + fragment ReplyListContainer5_viewer on User { + ...CommentContainer_viewer + ...LocalReplyListContainer_viewer } `, settings: graphql` @@ -228,10 +228,10 @@ const ReplyListContainer5 = createReplyListContainer( const ReplyListContainer4 = createReplyListContainer( 4, { - me: graphql` - fragment ReplyListContainer4_me on User { - ...ReplyListContainer5_me - ...CommentContainer_me + viewer: graphql` + fragment ReplyListContainer4_viewer on User { + ...ReplyListContainer5_viewer + ...CommentContainer_viewer } `, settings: graphql` @@ -289,10 +289,10 @@ const ReplyListContainer4 = createReplyListContainer( const ReplyListContainer3 = createReplyListContainer( 3, { - me: graphql` - fragment ReplyListContainer3_me on User { - ...ReplyListContainer4_me - ...CommentContainer_me + viewer: graphql` + fragment ReplyListContainer3_viewer on User { + ...ReplyListContainer4_viewer + ...CommentContainer_viewer } `, settings: graphql` @@ -350,10 +350,10 @@ const ReplyListContainer3 = createReplyListContainer( const ReplyListContainer2 = createReplyListContainer( 2, { - me: graphql` - fragment ReplyListContainer2_me on User { - ...ReplyListContainer3_me - ...CommentContainer_me + viewer: graphql` + fragment ReplyListContainer2_viewer on User { + ...ReplyListContainer3_viewer + ...CommentContainer_viewer } `, settings: graphql` @@ -411,10 +411,10 @@ const ReplyListContainer2 = createReplyListContainer( const ReplyListContainer1 = createReplyListContainer( 1, { - me: graphql` - fragment ReplyListContainer1_me on User { - ...ReplyListContainer2_me - ...CommentContainer_me + viewer: graphql` + fragment ReplyListContainer1_viewer on User { + ...ReplyListContainer2_viewer + ...CommentContainer_viewer } `, settings: graphql` diff --git a/src/core/client/stream/tabs/comments/containers/ReportButtonContainer.tsx b/src/core/client/stream/tabs/comments/containers/ReportButtonContainer.tsx index 80fff646c..b7ff8f188 100644 --- a/src/core/client/stream/tabs/comments/containers/ReportButtonContainer.tsx +++ b/src/core/client/stream/tabs/comments/containers/ReportButtonContainer.tsx @@ -3,7 +3,7 @@ import { graphql } from "react-relay"; import { withFragmentContainer } from "talk-framework/lib/relay"; import { ReportButtonContainer_comment as CommentData } from "talk-stream/__generated__/ReportButtonContainer_comment.graphql"; -import { ReportButtonContainer_me as MeData } from "talk-stream/__generated__/ReportButtonContainer_me.graphql"; +import { ReportButtonContainer_viewer as ViewerData } from "talk-stream/__generated__/ReportButtonContainer_viewer.graphql"; import { ReportButton, @@ -17,7 +17,7 @@ import { interface ReportButtonContainerProps { comment: CommentData; - me: MeData | null; + viewer: ViewerData | null; showAuthPopup: ShowAuthPopupMutation; } @@ -25,15 +25,15 @@ class ReportButtonContainer extends React.Component< ReportButtonContainerProps > { private get loggedIn() { - return this.props.me; + return this.props.viewer; } private handleSignIn = () => this.props.showAuthPopup({ view: "SIGN_IN" }); public render() { const reported = - this.props.comment.myActionPresence && - (this.props.comment.myActionPresence.flag || - this.props.comment.myActionPresence.dontAgree); + this.props.comment.viewerActionPresence && + (this.props.comment.viewerActionPresence.flag || + this.props.comment.viewerActionPresence.dontAgree); return this.loggedIn ? ( ({ - me: graphql` - fragment ReportButtonContainer_me on User { + viewer: graphql` + fragment ReportButtonContainer_viewer on User { id } `, @@ -57,7 +57,7 @@ export default withShowAuthPopupMutation( fragment ReportButtonContainer_comment on Comment { ...ReportCommentFormContainer_comment id - myActionPresence { + viewerActionPresence { dontAgree flag } diff --git a/src/core/client/stream/tabs/comments/containers/StreamContainer.spec.tsx b/src/core/client/stream/tabs/comments/containers/StreamContainer.spec.tsx index 5893b7dfc..eb3ed2f8c 100644 --- a/src/core/client/stream/tabs/comments/containers/StreamContainer.spec.tsx +++ b/src/core/client/stream/tabs/comments/containers/StreamContainer.spec.tsx @@ -20,7 +20,7 @@ it("renders correctly", () => { edges: [{ node: { id: "comment-1" } }, { node: { id: "comment-2" } }], }, }, - me: null, + viewer: null, settings: { reaction: { icon: "thumb_up_alt", @@ -47,7 +47,7 @@ describe("when has more comments", () => { edges: [{ node: { id: "comment-1" } }, { node: { id: "comment-2" } }], }, }, - me: null, + viewer: null, settings: { reaction: { icon: "thumb_up_alt", diff --git a/src/core/client/stream/tabs/comments/containers/StreamContainer.tsx b/src/core/client/stream/tabs/comments/containers/StreamContainer.tsx index a25dabc4d..c2324537f 100644 --- a/src/core/client/stream/tabs/comments/containers/StreamContainer.tsx +++ b/src/core/client/stream/tabs/comments/containers/StreamContainer.tsx @@ -3,9 +3,9 @@ import { graphql, RelayPaginationProp } from "react-relay"; import { withPaginationContainer } from "talk-framework/lib/relay"; import { PropTypesOf } from "talk-framework/types"; -import { StreamContainer_me as MeData } from "talk-stream/__generated__/StreamContainer_me.graphql"; import { StreamContainer_settings as SettingsData } from "talk-stream/__generated__/StreamContainer_settings.graphql"; import { StreamContainer_story as StoryData } from "talk-stream/__generated__/StreamContainer_story.graphql"; +import { StreamContainer_viewer as ViewerData } from "talk-stream/__generated__/StreamContainer_viewer.graphql"; import { COMMENT_SORT, StreamContainerPaginationQueryVariables, @@ -17,7 +17,7 @@ import Stream from "../components/Stream"; interface Props { story: StoryData; settings: SettingsData; - me: MeData | null; + viewer: ViewerData | null; relay: RelayPaginationProp; defaultOrderBy: COMMENT_SORT; } @@ -69,7 +69,7 @@ export class StreamContainer extends React.Component { onLoadMore={this.loadMore} hasMore={this.props.relay.hasMore()} disableLoadMore={this.state.disableLoadMore} - me={this.props.me} + viewer={this.props.viewer} orderBy={this.orderBy} onChangeOrderBy={this.handleOnChangeOrderBy} refetching={this.state.refetching} @@ -134,13 +134,13 @@ const enhanced = withPaginationContainer< ...CreateCommentMutation_story } `, - me: graphql` - fragment StreamContainer_me on User { - ...ReplyListContainer1_me - ...CommentContainer_me - ...UserBoxContainer_me - ...CreateCommentReplyMutation_me - ...CreateCommentMutation_me + viewer: graphql` + fragment StreamContainer_viewer on User { + ...ReplyListContainer1_viewer + ...CommentContainer_viewer + ...UserBoxContainer_viewer + ...CreateCommentReplyMutation_viewer + ...CreateCommentMutation_viewer } `, settings: graphql` diff --git a/src/core/client/stream/tabs/comments/containers/__snapshots__/CommentContainer.spec.tsx.snap b/src/core/client/stream/tabs/comments/containers/__snapshots__/CommentContainer.spec.tsx.snap index 9228984b7..28872406a 100644 --- a/src/core/client/stream/tabs/comments/containers/__snapshots__/CommentContainer.spec.tsx.snap +++ b/src/core/client/stream/tabs/comments/containers/__snapshots__/CommentContainer.spec.tsx.snap @@ -43,7 +43,6 @@ exports[`hide reply button 1`] = ` "status": "NONE", } } - me={null} settings={ Object { "disableCommenting": Object { @@ -51,6 +50,7 @@ exports[`hide reply button 1`] = ` }, } } + viewer={null} /> @@ -73,7 +73,7 @@ exports[`hide reply button 1`] = ` "status": "NONE", } } - me={null} + viewer={null} /> @@ -137,7 +137,6 @@ exports[`renders body only 1`] = ` "status": "NONE", } } - me={null} settings={ Object { "disableCommenting": Object { @@ -145,6 +144,7 @@ exports[`renders body only 1`] = ` }, } } + viewer={null} /> @@ -167,7 +167,7 @@ exports[`renders body only 1`] = ` "status": "NONE", } } - me={null} + viewer={null} /> @@ -231,7 +231,6 @@ exports[`renders disabled reply when commenting has been disabled 1`] = ` "status": "NONE", } } - me={null} settings={ Object { "disableCommenting": Object { @@ -239,6 +238,7 @@ exports[`renders disabled reply when commenting has been disabled 1`] = ` }, } } + viewer={null} /> @@ -261,7 +261,7 @@ exports[`renders disabled reply when commenting has been disabled 1`] = ` "status": "NONE", } } - me={null} + viewer={null} /> @@ -325,7 +325,6 @@ exports[`renders disabled reply when story is closed 1`] = ` "status": "NONE", } } - me={null} settings={ Object { "disableCommenting": Object { @@ -333,6 +332,7 @@ exports[`renders disabled reply when story is closed 1`] = ` }, } } + viewer={null} /> @@ -355,7 +355,7 @@ exports[`renders disabled reply when story is closed 1`] = ` "status": "NONE", } } - me={null} + viewer={null} /> @@ -423,7 +423,6 @@ exports[`renders in reply to 1`] = ` "status": "NONE", } } - me={null} settings={ Object { "disableCommenting": Object { @@ -431,6 +430,7 @@ exports[`renders in reply to 1`] = ` }, } } + viewer={null} /> @@ -457,7 +457,7 @@ exports[`renders in reply to 1`] = ` "status": "NONE", } } - me={null} + viewer={null} /> @@ -521,7 +521,6 @@ exports[`renders username and body 1`] = ` "status": "NONE", } } - me={null} settings={ Object { "disableCommenting": Object { @@ -529,6 +528,7 @@ exports[`renders username and body 1`] = ` }, } } + viewer={null} /> @@ -551,7 +551,7 @@ exports[`renders username and body 1`] = ` "status": "NONE", } } - me={null} + viewer={null} /> @@ -615,7 +615,6 @@ exports[`shows conversation link 1`] = ` "status": "NONE", } } - me={null} settings={ Object { "disableCommenting": Object { @@ -623,6 +622,7 @@ exports[`shows conversation link 1`] = ` }, } } + viewer={null} /> @@ -645,7 +645,7 @@ exports[`shows conversation link 1`] = ` "status": "NONE", } } - me={null} + viewer={null} /> diff --git a/src/core/client/stream/tabs/comments/containers/__snapshots__/ReplyListContainer.spec.tsx.snap b/src/core/client/stream/tabs/comments/containers/__snapshots__/ReplyListContainer.spec.tsx.snap index 446d4106e..519382475 100644 --- a/src/core/client/stream/tabs/comments/containers/__snapshots__/ReplyListContainer.spec.tsx.snap +++ b/src/core/client/stream/tabs/comments/containers/__snapshots__/ReplyListContainer.spec.tsx.snap @@ -32,7 +32,6 @@ exports[`renders correctly 1`] = ` "id": "comment-1", } } - me={null} settings={ Object { "reaction": Object { @@ -46,6 +45,7 @@ exports[`renders correctly 1`] = ` "id": "story-id", } } + viewer={null} />, "showConversationLink": false, }, @@ -57,7 +57,6 @@ exports[`renders correctly 1`] = ` "id": "comment-2", } } - me={null} settings={ Object { "reaction": Object { @@ -71,6 +70,7 @@ exports[`renders correctly 1`] = ` "id": "story-id", } } + viewer={null} />, "showConversationLink": false, }, @@ -79,7 +79,6 @@ exports[`renders correctly 1`] = ` disableShowAll={false} indentLevel={1} localReply={false} - me={null} onShowAll={[Function]} settings={ Object { @@ -94,6 +93,7 @@ exports[`renders correctly 1`] = ` "id": "story-id", } } + viewer={null} /> `; @@ -139,7 +139,6 @@ exports[`when has more replies renders hasMore 1`] = ` hasMore={true} indentLevel={1} localReply={false} - me={null} onShowAll={[Function]} settings={ Object { @@ -154,6 +153,7 @@ exports[`when has more replies renders hasMore 1`] = ` "id": "story-id", } } + viewer={null} /> `; @@ -197,7 +197,6 @@ exports[`when has more replies when showing all disables show all button 1`] = ` hasMore={true} indentLevel={1} localReply={false} - me={null} onShowAll={[Function]} settings={ Object { @@ -212,6 +211,7 @@ exports[`when has more replies when showing all disables show all button 1`] = ` "id": "story-id", } } + viewer={null} /> `; @@ -255,7 +255,6 @@ exports[`when has more replies when showing all enable show all button after loa hasMore={true} indentLevel={1} localReply={false} - me={null} onShowAll={[Function]} settings={ Object { @@ -270,5 +269,6 @@ exports[`when has more replies when showing all enable show all button after loa "id": "story-id", } } + viewer={null} /> `; diff --git a/src/core/client/stream/tabs/comments/containers/__snapshots__/StreamContainer.spec.tsx.snap b/src/core/client/stream/tabs/comments/containers/__snapshots__/StreamContainer.spec.tsx.snap index 2cbe540fd..d94edd847 100644 --- a/src/core/client/stream/tabs/comments/containers/__snapshots__/StreamContainer.spec.tsx.snap +++ b/src/core/client/stream/tabs/comments/containers/__snapshots__/StreamContainer.spec.tsx.snap @@ -36,7 +36,6 @@ exports[`renders correctly 1`] = ` ] } disableLoadMore={false} - me={null} onChangeOrderBy={[Function]} onLoadMore={[Function]} orderBy="CREATED_AT_ASC" @@ -69,6 +68,7 @@ exports[`renders correctly 1`] = ` "isClosed": false, } } + viewer={null} /> `; @@ -110,7 +110,6 @@ exports[`when has more comments renders hasMore 1`] = ` } disableLoadMore={false} hasMore={true} - me={null} onChangeOrderBy={[Function]} onLoadMore={[Function]} orderBy="CREATED_AT_ASC" @@ -143,6 +142,7 @@ exports[`when has more comments renders hasMore 1`] = ` "isClosed": false, } } + viewer={null} /> `; @@ -184,7 +184,6 @@ exports[`when has more comments when loading more disables load more button 1`] } disableLoadMore={true} hasMore={true} - me={null} onChangeOrderBy={[Function]} onLoadMore={[Function]} orderBy="CREATED_AT_ASC" @@ -217,6 +216,7 @@ exports[`when has more comments when loading more disables load more button 1`] "isClosed": false, } } + viewer={null} /> `; @@ -258,7 +258,6 @@ exports[`when has more comments when loading more enable load more button after } disableLoadMore={false} hasMore={true} - me={null} onChangeOrderBy={[Function]} onLoadMore={[Function]} orderBy="CREATED_AT_ASC" @@ -291,6 +290,7 @@ exports[`when has more comments when loading more enable load more button after "isClosed": false, } } + viewer={null} /> `; diff --git a/src/core/client/stream/tabs/comments/queries/StreamQuery.tsx b/src/core/client/stream/tabs/comments/queries/StreamQuery.tsx index a6c763758..3ff2369f5 100644 --- a/src/core/client/stream/tabs/comments/queries/StreamQuery.tsx +++ b/src/core/client/stream/tabs/comments/queries/StreamQuery.tsx @@ -34,7 +34,7 @@ export const render = ( return ( @@ -60,8 +60,8 @@ const StreamQuery: StatelessComponent = props => { $storyURL: String $streamOrderBy: COMMENT_SORT ) { - me { - ...StreamContainer_me + viewer { + ...StreamContainer_viewer } story(id: $storyID, url: $storyURL) { ...StreamContainer_story @arguments(orderBy: $streamOrderBy) diff --git a/src/core/client/stream/tabs/comments/views/permalink/components/ConversationThread.spec.tsx b/src/core/client/stream/tabs/comments/views/permalink/components/ConversationThread.spec.tsx index f9669c1ab..0f294c2e7 100644 --- a/src/core/client/stream/tabs/comments/views/permalink/components/ConversationThread.spec.tsx +++ b/src/core/client/stream/tabs/comments/views/permalink/components/ConversationThread.spec.tsx @@ -13,7 +13,7 @@ describe("with 2 remaining parent comments", () => { it("renders correctly", () => { const props: PropTypesOf = { className: "root", - me: {}, + viewer: {}, story: {}, settings: {}, comment: {}, @@ -34,7 +34,7 @@ describe("with 2 remaining parent comments", () => { it("renders with disabled load more", () => { const props: PropTypesOf = { className: "root", - me: {}, + viewer: {}, story: {}, settings: {}, comment: {}, @@ -57,7 +57,7 @@ describe("with 2 remaining parent comments", () => { it("renders with no parent comments", () => { const props: PropTypesOf = { className: "root", - me: {}, + viewer: {}, story: {}, settings: {}, comment: {}, diff --git a/src/core/client/stream/tabs/comments/views/permalink/components/ConversationThread.tsx b/src/core/client/stream/tabs/comments/views/permalink/components/ConversationThread.tsx index da5597eef..5d1c31852 100644 --- a/src/core/client/stream/tabs/comments/views/permalink/components/ConversationThread.tsx +++ b/src/core/client/stream/tabs/comments/views/permalink/components/ConversationThread.tsx @@ -14,8 +14,8 @@ import { Circle, Line } from "./Timeline"; export interface ConversationThreadProps { className?: string; - me: PropTypesOf["me"] & - (PropTypesOf["me"] | null); + viewer: PropTypesOf["viewer"] & + (PropTypesOf["viewer"] | null); story: PropTypesOf["story"] & PropTypesOf["story"]; settings: PropTypesOf["settings"] & @@ -49,7 +49,7 @@ const ConversationThread: StatelessComponent< comment={props.comment} story={props.story} settings={props.settings} - me={props.me} + viewer={props.viewer} highlight />
@@ -94,14 +94,14 @@ const ConversationThread: StatelessComponent< - {props.me && ( + {props.viewer && ( diff --git a/src/core/client/stream/tabs/comments/views/permalink/components/PermalinkView.spec.tsx b/src/core/client/stream/tabs/comments/views/permalink/components/PermalinkView.spec.tsx index fac493e6c..90d553583 100644 --- a/src/core/client/stream/tabs/comments/views/permalink/components/PermalinkView.spec.tsx +++ b/src/core/client/stream/tabs/comments/views/permalink/components/PermalinkView.spec.tsx @@ -11,7 +11,7 @@ const PermalinkViewN = removeFragmentRefs(PermalinkView); it("renders correctly", () => { const props: PropTypesOf = { - me: {}, + viewer: {}, story: {}, settings: {}, comment: {}, @@ -25,7 +25,7 @@ it("renders correctly", () => { it("renders comment not found", () => { const props: PropTypesOf = { - me: {}, + viewer: {}, story: {}, settings: {}, comment: null, diff --git a/src/core/client/stream/tabs/comments/views/permalink/components/PermalinkView.tsx b/src/core/client/stream/tabs/comments/views/permalink/components/PermalinkView.tsx index 99793b10c..a31861cdd 100644 --- a/src/core/client/stream/tabs/comments/views/permalink/components/PermalinkView.tsx +++ b/src/core/client/stream/tabs/comments/views/permalink/components/PermalinkView.tsx @@ -12,9 +12,9 @@ import ConversationThreadContainer from "../containers/ConversationThreadContain import styles from "./PermalinkView.css"; export interface PermalinkViewProps { - me: PropTypesOf["me"] & - PropTypesOf["me"] & - PropTypesOf["me"]; + viewer: PropTypesOf["viewer"] & + PropTypesOf["viewer"] & + PropTypesOf["viewer"]; story: PropTypesOf["story"] & PropTypesOf["story"]; comment: @@ -34,11 +34,11 @@ const PermalinkView: StatelessComponent = ({ settings, story, onShowAllComments, - me, + viewer, }) => { return ( - + @@ -71,14 +71,14 @@ const PermalinkView: StatelessComponent = ({ {comment && (
`; @@ -70,9 +70,9 @@ exports[`with 2 remaining parent comments renders correctly 1`] = ` @@ -134,9 +134,9 @@ exports[`with 2 remaining parent comments renders with disabled load more 1`] = diff --git a/src/core/client/stream/tabs/comments/views/permalink/components/__snapshots__/PermalinkView.spec.tsx.snap b/src/core/client/stream/tabs/comments/views/permalink/components/__snapshots__/PermalinkView.spec.tsx.snap index eb1617698..bfdd3e422 100644 --- a/src/core/client/stream/tabs/comments/views/permalink/components/__snapshots__/PermalinkView.spec.tsx.snap +++ b/src/core/client/stream/tabs/comments/views/permalink/components/__snapshots__/PermalinkView.spec.tsx.snap @@ -6,8 +6,8 @@ exports[`renders comment not found 1`] = ` size="double" >
diff --git a/src/core/client/stream/tabs/comments/views/permalink/containers/ConversationThreadContainer.tsx b/src/core/client/stream/tabs/comments/views/permalink/containers/ConversationThreadContainer.tsx index ac49b218e..cb0d6f53c 100644 --- a/src/core/client/stream/tabs/comments/views/permalink/containers/ConversationThreadContainer.tsx +++ b/src/core/client/stream/tabs/comments/views/permalink/containers/ConversationThreadContainer.tsx @@ -5,9 +5,9 @@ import { graphql, RelayPaginationProp } from "react-relay"; import { withContext } from "talk-framework/lib/bootstrap"; import { withPaginationContainer } from "talk-framework/lib/relay"; import { ConversationThreadContainer_comment as CommentData } from "talk-stream/__generated__/ConversationThreadContainer_comment.graphql"; -import { ConversationThreadContainer_me as MeData } from "talk-stream/__generated__/ConversationThreadContainer_me.graphql"; import { ConversationThreadContainer_settings as SettingsData } from "talk-stream/__generated__/ConversationThreadContainer_settings.graphql"; import { ConversationThreadContainer_story as StoryData } from "talk-stream/__generated__/ConversationThreadContainer_story.graphql"; +import { ConversationThreadContainer_viewer as ViewerData } from "talk-stream/__generated__/ConversationThreadContainer_viewer.graphql"; import { ConversationThreadContainerPaginationQueryVariables } from "talk-stream/__generated__/ConversationThreadContainerPaginationQuery.graphql"; import { SetCommentIDMutation, @@ -20,7 +20,7 @@ interface ConversationThreadContainerProps { comment: CommentData; story: StoryData; settings: SettingsData; - me: MeData | null; + viewer: ViewerData | null; setCommentID: SetCommentIDMutation; pym: PymChild | undefined; relay: RelayPaginationProp; @@ -51,11 +51,11 @@ class ConversationThreadContainer extends React.Component< }; public render() { - const { comment, story, me, settings } = this.props; + const { comment, story, viewer, settings } = this.props; const hasMore = this.props.relay.hasMore(); return ( ({ } } `, - me: graphql` - fragment ConversationThreadContainer_me on User { - ...CommentContainer_me - ...LocalReplyListContainer_me + viewer: graphql` + fragment ConversationThreadContainer_viewer on User { + ...CommentContainer_viewer + ...LocalReplyListContainer_viewer } `, }, diff --git a/src/core/client/stream/tabs/comments/views/permalink/containers/PermalinkViewContainer.tsx b/src/core/client/stream/tabs/comments/views/permalink/containers/PermalinkViewContainer.tsx index 64a7fc68f..fa99a60c8 100644 --- a/src/core/client/stream/tabs/comments/views/permalink/containers/PermalinkViewContainer.tsx +++ b/src/core/client/stream/tabs/comments/views/permalink/containers/PermalinkViewContainer.tsx @@ -6,9 +6,9 @@ import { getURLWithCommentID } from "talk-framework/helpers"; import { withContext } from "talk-framework/lib/bootstrap"; import { withFragmentContainer } from "talk-framework/lib/relay"; import { PermalinkViewContainer_comment as CommentData } from "talk-stream/__generated__/PermalinkViewContainer_comment.graphql"; -import { PermalinkViewContainer_me as MeData } from "talk-stream/__generated__/PermalinkViewContainer_me.graphql"; import { PermalinkViewContainer_settings as SettingsData } from "talk-stream/__generated__/PermalinkViewContainer_settings.graphql"; import { PermalinkViewContainer_story as StoryData } from "talk-stream/__generated__/PermalinkViewContainer_story.graphql"; +import { PermalinkViewContainer_viewer as ViewerData } from "talk-stream/__generated__/PermalinkViewContainer_viewer.graphql"; import { SetCommentIDMutation, withSetCommentIDMutation, @@ -20,7 +20,7 @@ interface PermalinkViewContainerProps { comment: CommentData | null; story: StoryData; settings: SettingsData; - me: MeData | null; + viewer: ViewerData | null; setCommentID: SetCommentIDMutation; pym: PymChild | undefined; } @@ -45,10 +45,10 @@ class PermalinkViewContainer extends React.Component< } public render() { - const { comment, story, me, settings } = this.props; + const { comment, story, viewer, settings } = this.props; return ( ({ ...ReplyListContainer1_comment } `, - me: graphql` - fragment PermalinkViewContainer_me on User { - ...ConversationThreadContainer_me - ...ReplyListContainer1_me - ...UserBoxContainer_me + viewer: graphql` + fragment PermalinkViewContainer_viewer on User { + ...ConversationThreadContainer_viewer + ...ReplyListContainer1_viewer + ...UserBoxContainer_viewer } `, settings: graphql` diff --git a/src/core/client/stream/tabs/comments/views/permalink/queries/PermalinkViewQuery.tsx b/src/core/client/stream/tabs/comments/views/permalink/queries/PermalinkViewQuery.tsx index fda2adddf..a73245ad2 100644 --- a/src/core/client/stream/tabs/comments/views/permalink/queries/PermalinkViewQuery.tsx +++ b/src/core/client/stream/tabs/comments/views/permalink/queries/PermalinkViewQuery.tsx @@ -35,7 +35,7 @@ export const render = ({ } return ( = ({ $storyID: ID $storyURL: String ) { - me { - ...PermalinkViewContainer_me + viewer { + ...PermalinkViewContainer_viewer } story(id: $storyID, url: $storyURL) { ...PermalinkViewContainer_story diff --git a/src/core/client/stream/tabs/configure/components/Configure.tsx b/src/core/client/stream/tabs/configure/components/Configure.tsx index f42b4926a..bb8641d61 100644 --- a/src/core/client/stream/tabs/configure/components/Configure.tsx +++ b/src/core/client/stream/tabs/configure/components/Configure.tsx @@ -9,7 +9,7 @@ import OpenOrCloseStreamContainer from "../containers/OpenOrCloseStreamContainer import HorizontalRule from "./HorizontalRule"; export interface Props { - me: PropTypesOf["me"]; + viewer: PropTypesOf["viewer"]; settings: PropTypesOf["settings"]; story: PropTypesOf["story"] & PropTypesOf["story"]; @@ -19,7 +19,7 @@ const Configure: StatelessComponent = props => { return (
- + diff --git a/src/core/client/stream/tabs/configure/containers/ConfigureContainer.tsx b/src/core/client/stream/tabs/configure/containers/ConfigureContainer.tsx index cd361cd8b..34f7c8285 100644 --- a/src/core/client/stream/tabs/configure/containers/ConfigureContainer.tsx +++ b/src/core/client/stream/tabs/configure/containers/ConfigureContainer.tsx @@ -2,14 +2,14 @@ import React from "react"; import { graphql } from "react-relay"; import { withFragmentContainer } from "talk-framework/lib/relay"; -import { ConfigureContainer_me as MeData } from "talk-stream/__generated__/ConfigureContainer_me.graphql"; import { ConfigureContainer_settings as SettingsData } from "talk-stream/__generated__/ConfigureContainer_settings.graphql"; import { ConfigureContainer_story as StoryData } from "talk-stream/__generated__/ConfigureContainer_story.graphql"; +import { ConfigureContainer_viewer as ViewerData } from "talk-stream/__generated__/ConfigureContainer_viewer.graphql"; import Configure from "../components/Configure"; interface ConfigureContainerProps { - me: MeData; + viewer: ViewerData; settings: SettingsData; story: StoryData; } @@ -20,7 +20,7 @@ export class StreamContainer extends React.Component { ); } @@ -32,9 +32,9 @@ const enhanced = withFragmentContainer({ ...OpenOrCloseStreamContainer_story } `, - me: graphql` - fragment ConfigureContainer_me on User { - ...UserBoxContainer_me + viewer: graphql` + fragment ConfigureContainer_viewer on User { + ...UserBoxContainer_viewer } `, settings: graphql` diff --git a/src/core/client/stream/tabs/configure/queries/ConfigureQuery.tsx b/src/core/client/stream/tabs/configure/queries/ConfigureQuery.tsx index 07e1a8e8a..9dd821807 100644 --- a/src/core/client/stream/tabs/configure/queries/ConfigureQuery.tsx +++ b/src/core/client/stream/tabs/configure/queries/ConfigureQuery.tsx @@ -37,7 +37,7 @@ export const render = ({ preloadConfigureContainer(); if (props) { - if (!props.me) { + if (!props.viewer) { return (
Error loading configure
@@ -54,7 +54,7 @@ export const render = ({ return ( }> @@ -78,8 +78,8 @@ const ConfigureQuery: StatelessComponent = ({ story(id: $storyID, url: $storyURL) { ...ConfigureContainer_story } - me { - ...ConfigureContainer_me + viewer { + ...ConfigureContainer_viewer } settings { ...ConfigureContainer_settings diff --git a/src/core/client/stream/tabs/profile/components/Profile.spec.tsx b/src/core/client/stream/tabs/profile/components/Profile.spec.tsx index e4df8a664..5eb0c4bb1 100644 --- a/src/core/client/stream/tabs/profile/components/Profile.spec.tsx +++ b/src/core/client/stream/tabs/profile/components/Profile.spec.tsx @@ -11,7 +11,7 @@ const ProfileN = removeFragmentRefs(Profile); it("renders correctly", () => { const props: PropTypesOf = { story: {}, - me: {}, + viewer: {}, settings: {}, }; const renderer = createRenderer(); diff --git a/src/core/client/stream/tabs/profile/components/Profile.tsx b/src/core/client/stream/tabs/profile/components/Profile.tsx index f791d9baf..9d3189b8a 100644 --- a/src/core/client/stream/tabs/profile/components/Profile.tsx +++ b/src/core/client/stream/tabs/profile/components/Profile.tsx @@ -7,16 +7,16 @@ import CommentHistoryContainer from "../containers/CommentHistoryContainer"; export interface ProfileProps { story: PropTypesOf["story"]; - me: PropTypesOf["me"] & - PropTypesOf["me"]; + viewer: PropTypesOf["viewer"] & + PropTypesOf["viewer"]; settings: PropTypesOf["settings"]; } const Profile: StatelessComponent = props => { return ( - - + + ); }; diff --git a/src/core/client/stream/tabs/profile/components/__snapshots__/Profile.spec.tsx.snap b/src/core/client/stream/tabs/profile/components/__snapshots__/Profile.spec.tsx.snap index 0952c1551..937a7544c 100644 --- a/src/core/client/stream/tabs/profile/components/__snapshots__/Profile.spec.tsx.snap +++ b/src/core/client/stream/tabs/profile/components/__snapshots__/Profile.spec.tsx.snap @@ -5,12 +5,12 @@ exports[`renders correctly 1`] = ` size="double" > `; diff --git a/src/core/client/stream/tabs/profile/containers/CommentHistoryContainer.tsx b/src/core/client/stream/tabs/profile/containers/CommentHistoryContainer.tsx index 7f215e9c5..f2eb3e9b0 100644 --- a/src/core/client/stream/tabs/profile/containers/CommentHistoryContainer.tsx +++ b/src/core/client/stream/tabs/profile/containers/CommentHistoryContainer.tsx @@ -2,14 +2,14 @@ import React from "react"; import { graphql, RelayPaginationProp } from "react-relay"; import { withPaginationContainer } from "talk-framework/lib/relay"; -import { CommentHistoryContainer_me as MeData } from "talk-stream/__generated__/CommentHistoryContainer_me.graphql"; import { CommentHistoryContainer_story as StoryData } from "talk-stream/__generated__/CommentHistoryContainer_story.graphql"; +import { CommentHistoryContainer_viewer as ViewerData } from "talk-stream/__generated__/CommentHistoryContainer_viewer.graphql"; import { CommentHistoryContainerPaginationQueryVariables } from "talk-stream/__generated__/CommentHistoryContainerPaginationQuery.graphql"; import CommentHistory from "../components/CommentHistory"; interface CommentHistoryContainerProps { - me: MeData; + viewer: ViewerData; story: StoryData; relay: RelayPaginationProp; } @@ -22,7 +22,7 @@ export class CommentHistoryContainer extends React.Component< }; public render() { - const comments = this.props.me.comments.edges.map(edge => edge.node); + const comments = this.props.viewer.comments.edges.map(edge => edge.node); return ( { public render() { return ( @@ -31,10 +31,10 @@ const enhanced = withFragmentContainer({ ...CommentHistoryContainer_story } `, - me: graphql` - fragment ProfileContainer_me on User { - ...UserBoxContainer_me - ...CommentHistoryContainer_me + viewer: graphql` + fragment ProfileContainer_viewer on User { + ...UserBoxContainer_viewer + ...CommentHistoryContainer_viewer } `, settings: graphql` diff --git a/src/core/client/stream/tabs/profile/queries/ProfileQuery.tsx b/src/core/client/stream/tabs/profile/queries/ProfileQuery.tsx index 6bc9502b6..85f3dae8c 100644 --- a/src/core/client/stream/tabs/profile/queries/ProfileQuery.tsx +++ b/src/core/client/stream/tabs/profile/queries/ProfileQuery.tsx @@ -35,7 +35,7 @@ export const render = ({ preloadProfileContainer(); if (props) { - if (!props.me) { + if (!props.viewer) { return (
Error loading profile
@@ -52,7 +52,7 @@ export const render = ({ return ( }> @@ -76,8 +76,8 @@ const ProfileQuery: StatelessComponent = ({ story(id: $storyID, url: $storyURL) { ...ProfileContainer_story } - me { - ...ProfileContainer_me + viewer { + ...ProfileContainer_viewer } settings { ...ProfileContainer_settings diff --git a/src/core/client/stream/test/comments/charCountEditComment.spec.tsx b/src/core/client/stream/test/comments/charCountEditComment.spec.tsx index 399af648d..32668ab06 100644 --- a/src/core/client/stream/test/comments/charCountEditComment.spec.tsx +++ b/src/core/client/stream/test/comments/charCountEditComment.spec.tsx @@ -38,7 +38,7 @@ async function createTestRenderer( ...resolver, Query: { settings: sinon.stub().returns(settingsWithCharCount), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), story: sinon.stub().returns(stories[0]), ...resolver.Query, }, diff --git a/src/core/client/stream/test/comments/charCountPostComment.spec.tsx b/src/core/client/stream/test/comments/charCountPostComment.spec.tsx index 43fc7a83d..e63c687f3 100644 --- a/src/core/client/stream/test/comments/charCountPostComment.spec.tsx +++ b/src/core/client/stream/test/comments/charCountPostComment.spec.tsx @@ -30,7 +30,7 @@ async function createTestRenderer( ...resolver, Query: { settings: sinon.stub().returns(settingsWithCharCount), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), story: sinon.stub().returns(stories[0]), ...resolver.Query, }, diff --git a/src/core/client/stream/test/comments/charCountReplyComment.spec.tsx b/src/core/client/stream/test/comments/charCountReplyComment.spec.tsx index 2176b1b34..17f5eeffe 100644 --- a/src/core/client/stream/test/comments/charCountReplyComment.spec.tsx +++ b/src/core/client/stream/test/comments/charCountReplyComment.spec.tsx @@ -30,7 +30,7 @@ async function createTestRenderer( ...resolver, Query: { settings: sinon.stub().returns(settingsWithCharCount), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), story: sinon.stub().returns(stories[0]), ...resolver.Query, }, diff --git a/src/core/client/stream/test/comments/editComment.spec.tsx b/src/core/client/stream/test/comments/editComment.spec.tsx index 091bc2cd9..e44740304 100644 --- a/src/core/client/stream/test/comments/editComment.spec.tsx +++ b/src/core/client/stream/test/comments/editComment.spec.tsx @@ -30,7 +30,7 @@ function createTestRenderer( .withArgs(undefined, { id: storyWithReplies.id, url: null }) .returns(storyWithReplies) ), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), settings: sinon.stub().returns(settings), }, Mutation: { diff --git a/src/core/client/stream/test/comments/postComment.spec.tsx b/src/core/client/stream/test/comments/postComment.spec.tsx index ada186399..b2f2d89c6 100644 --- a/src/core/client/stream/test/comments/postComment.spec.tsx +++ b/src/core/client/stream/test/comments/postComment.spec.tsx @@ -23,7 +23,7 @@ async function createTestRenderer( ...resolver, Query: { settings: sinon.stub().returns(settings), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), story: sinon.stub().callsFake((_: any, variables: any) => { expectAndFail(variables.id).toBe(stories[0].id); return stories[0]; diff --git a/src/core/client/stream/test/comments/postLocalReply.spec.tsx b/src/core/client/stream/test/comments/postLocalReply.spec.tsx index e554b5472..41a790925 100644 --- a/src/core/client/stream/test/comments/postLocalReply.spec.tsx +++ b/src/core/client/stream/test/comments/postLocalReply.spec.tsx @@ -21,7 +21,7 @@ beforeEach(() => { const resolvers = { Query: { settings: sinon.stub().returns(settings), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), story: createSinonStub( s => s.throws(), s => diff --git a/src/core/client/stream/test/comments/postReply.spec.tsx b/src/core/client/stream/test/comments/postReply.spec.tsx index d0554cef2..933d25853 100644 --- a/src/core/client/stream/test/comments/postReply.spec.tsx +++ b/src/core/client/stream/test/comments/postReply.spec.tsx @@ -21,7 +21,7 @@ async function createTestRenderer( ...resolver, Query: { settings: sinon.stub().returns(settings), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), story: sinon.stub().callsFake((_: any, variables: any) => { expectAndFail(variables.id).toBe(stories[0].id); return stories[0]; diff --git a/src/core/client/stream/test/comments/reaction.spec.tsx b/src/core/client/stream/test/comments/reaction.spec.tsx index 9d686fd89..2ec622bed 100644 --- a/src/core/client/stream/test/comments/reaction.spec.tsx +++ b/src/core/client/stream/test/comments/reaction.spec.tsx @@ -15,7 +15,7 @@ function createTestRenderer() { }); return stories[0]; }), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), settings: sinon.stub().returns(settings), }, Mutation: { @@ -28,7 +28,7 @@ function createTestRenderer() { comment: { id: stories[0].comments.edges[0].node.id, revision: { id: stories[0].comments.edges[0].node.revision.id }, - myActionPresence: { reaction: true }, + viewerActionPresence: { reaction: true }, actionCounts: { reaction: { total: 1 } }, }, clientMutationId: data.input.clientMutationId, @@ -42,7 +42,7 @@ function createTestRenderer() { comment: { id: stories[0].comments.edges[0].node.id, revision: { id: stories[0].comments.edges[0].node.revision.id }, - myActionPresence: { reaction: false }, + viewerActionPresence: { reaction: false }, actionCounts: { reaction: { total: 0 } }, }, clientMutationId: data.input.clientMutationId, diff --git a/src/core/client/stream/test/comments/renderMessageBox.spec.tsx b/src/core/client/stream/test/comments/renderMessageBox.spec.tsx index ed978a137..4f93edb22 100644 --- a/src/core/client/stream/test/comments/renderMessageBox.spec.tsx +++ b/src/core/client/stream/test/comments/renderMessageBox.spec.tsx @@ -17,7 +17,7 @@ async function createTestRenderer( const resolvers = { Query: { settings: sinon.stub().returns(merge({}, settings, data.settings)), - me: sinon.stub().returns((data.loggedIn && users[0]) || null), + viewer: sinon.stub().returns((data.loggedIn && users[0]) || null), story: sinon.stub().callsFake((_: any, variables: any) => { expectAndFail(variables.id).toBe(storyWithNoComments.id); return merge({}, storyWithNoComments, data.story); diff --git a/src/core/client/stream/test/comments/reportComment.spec.tsx b/src/core/client/stream/test/comments/reportComment.spec.tsx index 0c61f3fed..9e8e6c733 100644 --- a/src/core/client/stream/test/comments/reportComment.spec.tsx +++ b/src/core/client/stream/test/comments/reportComment.spec.tsx @@ -21,7 +21,7 @@ function createTestRenderer( }); return stories[0]; }), - me: sinon.stub().returns(users[0]), + viewer: sinon.stub().returns(users[0]), settings: sinon.stub().returns(settings), ...resolver.Query, }, @@ -36,7 +36,7 @@ function createTestRenderer( return { comment: { id: stories[0].comments.edges[0].node.id, - myActionPresence: { flag: true }, + viewerActionPresence: { flag: true }, }, clientMutationId: data.input.clientMutationId, }; @@ -50,7 +50,7 @@ function createTestRenderer( return { comment: { id: stories[0].comments.edges[0].node.id, - myActionPresence: { dontAgree: true }, + viewerActionPresence: { dontAgree: true }, }, clientMutationId: data.input.clientMutationId, }; diff --git a/src/core/client/stream/test/configure/openOrCloseStream.spec.tsx b/src/core/client/stream/test/configure/openOrCloseStream.spec.tsx index 3e19af324..d454cd846 100644 --- a/src/core/client/stream/test/configure/openOrCloseStream.spec.tsx +++ b/src/core/client/stream/test/configure/openOrCloseStream.spec.tsx @@ -14,7 +14,7 @@ async function createTestRenderer( Query: { settings: sinon.stub().returns(settings), story: sinon.stub().returns(stories[0]), - me: sinon.stub().returns(meAsModerator), + viewer: sinon.stub().returns(meAsModerator), ...resolver.Query, }, }; diff --git a/src/core/client/stream/test/configure/renderConfigure.spec.tsx b/src/core/client/stream/test/configure/renderConfigure.spec.tsx index 3b0420e2e..47820ba4f 100644 --- a/src/core/client/stream/test/configure/renderConfigure.spec.tsx +++ b/src/core/client/stream/test/configure/renderConfigure.spec.tsx @@ -16,7 +16,7 @@ async function createTestRenderer( expectAndFail(variables).toEqual({ id: stories[0].id, url: null }); return stories[0]; }), - me: sinon.stub().returns(meAsModerator), + viewer: sinon.stub().returns(meAsModerator), ...resolver.Query, }, ...resolver, diff --git a/src/core/client/stream/test/configure/streamConfiguration.spec.tsx b/src/core/client/stream/test/configure/streamConfiguration.spec.tsx index 67b50d204..3b3cdc412 100644 --- a/src/core/client/stream/test/configure/streamConfiguration.spec.tsx +++ b/src/core/client/stream/test/configure/streamConfiguration.spec.tsx @@ -22,7 +22,7 @@ async function createTestRenderer( expectAndFail(variables).toEqual({ id: stories[0].id, url: null }); return stories[0]; }), - me: sinon.stub().returns(meAsModerator), + viewer: sinon.stub().returns(meAsModerator), ...resolver.Query, }, ...resolver, diff --git a/src/core/client/stream/test/profile/loadMore.spec.tsx b/src/core/client/stream/test/profile/loadMore.spec.tsx index 7707dd173..35ddb00b2 100644 --- a/src/core/client/stream/test/profile/loadMore.spec.tsx +++ b/src/core/client/stream/test/profile/loadMore.spec.tsx @@ -66,7 +66,7 @@ beforeEach(() => { .withArgs(undefined, { id: stories[0].id, url: null }) .returns(stories[0]) ), - me: sinon.stub().returns(meStub), + viewer: sinon.stub().returns(meStub), }, }; diff --git a/src/core/client/stream/test/profile/renderProfile.spec.tsx b/src/core/client/stream/test/profile/renderProfile.spec.tsx index 91d1428ca..28713b476 100644 --- a/src/core/client/stream/test/profile/renderProfile.spec.tsx +++ b/src/core/client/stream/test/profile/renderProfile.spec.tsx @@ -22,7 +22,7 @@ beforeEach(() => { .withArgs(undefined, { id: stories[0].id, url: null }) .returns(stories[0]) ), - me: sinon.stub().returns(meWithComments), + viewer: sinon.stub().returns(meWithComments), }, }; diff --git a/src/core/server/graph/tenant/resolvers/Comment.ts b/src/core/server/graph/tenant/resolvers/Comment.ts index 3e6861756..6d2384274 100644 --- a/src/core/server/graph/tenant/resolvers/Comment.ts +++ b/src/core/server/graph/tenant/resolvers/Comment.ts @@ -64,7 +64,7 @@ export const Comment: GQLCommentTypeResolver = { : createConnection(), // Action Counts are encoded, decode them for use with the GraphQL system. actionCounts: c => decodeActionCounts(c.actionCounts), - myActionPresence: (c, input, ctx) => + viewerActionPresence: (c, input, ctx) => ctx.user ? ctx.loaders.Comments.retrieveMyActionPresence.load(c.id) : null, parentCount: c => (c.parentID ? c.grandparentIDs.length + 1 : 0), depth: c => (c.parentID ? c.grandparentIDs.length + 1 : 0), diff --git a/src/core/server/graph/tenant/resolvers/Query.ts b/src/core/server/graph/tenant/resolvers/Query.ts index 98ec7735c..f32611707 100644 --- a/src/core/server/graph/tenant/resolvers/Query.ts +++ b/src/core/server/graph/tenant/resolvers/Query.ts @@ -11,7 +11,7 @@ export const Query: Required> = { id ? ctx.loaders.Comments.comment.load(id) : null, comments: (source, args, ctx) => ctx.loaders.Comments.forFilter(args), settings: (source, args, ctx) => ctx.tenant, - me: (source, args, ctx) => ctx.user, + viewer: (source, args, ctx) => ctx.user, discoverOIDCConfiguration: (source, { issuer }, ctx) => ctx.loaders.Auth.discoverOIDCConfiguration.load(issuer), debugScrapeStoryMetadata: (source, { url }, ctx) => diff --git a/src/core/server/graph/tenant/schema/schema.graphql b/src/core/server/graph/tenant/schema/schema.graphql index 1f0f79f79..52160b824 100644 --- a/src/core/server/graph/tenant/schema/schema.graphql +++ b/src/core/server/graph/tenant/schema/schema.graphql @@ -1425,10 +1425,10 @@ type Comment { actionCounts: ActionCounts! """ - myActionPresence stores the presence information for all the actions + viewerActionPresence stores the presence information for all the actions left by the current User on this Comment. """ - myActionPresence: ActionPresence + viewerActionPresence: ActionPresence """ story is the Story that the Comment was written on. @@ -1785,11 +1785,11 @@ type Query { @auth(roles: [ADMIN, MODERATOR]) """ - me is the current logged in User. If no user is currently logged in, it will + viewer is the current logged in User. If no user is currently logged in, it will return null. This is the only nullable field that can be returned that depends on the authentication state that will not throw an error. """ - me: User + viewer: User """ settings is the Settings for a given Tenant. diff --git a/src/locales/en-US/admin.ftl b/src/locales/en-US/admin.ftl index d721b1a44..bdeed1933 100644 --- a/src/locales/en-US/admin.ftl +++ b/src/locales/en-US/admin.ftl @@ -12,7 +12,7 @@ navigation-configure = Configure ## User Menu userMenu-signOut = Sign Out -userMenu-viewLatestVersion = View Latest Release +userMenu-viewLatestRelease = View Latest Release userMenu-reportBug = Report a Bug or Give Feedback userMenu-popover = .description = A dialog of the user menu with related links and actions