mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
[CORL-678] Transition to eslint (#2634)
* chore: setup eslint * chore: tslint checks with types & check for import order * chore: complete eslint transition * fix: tests * fix: linting after rebase, faster lint for lint-staged * chore: remove line * fix: lint rules * feat: add a11y linter and fix errors * fix: tests
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import cn from "classnames";
|
||||
import { HorizontalGutter, TabContent, TabPane } from "coral-ui/components";
|
||||
import React, { FunctionComponent } from "react";
|
||||
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { HorizontalGutter, TabContent, TabPane } from "coral-ui/components";
|
||||
|
||||
import Comments from "../tabs/Comments";
|
||||
import Configure from "../tabs/Configure";
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import React from "react";
|
||||
|
||||
import { graphql, withLocalStateContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import { AppContainerLocal as Local } from "coral-stream/__generated__/AppContainerLocal.graphql";
|
||||
|
||||
import App from "./App";
|
||||
import {
|
||||
OnEvents,
|
||||
OnPostMessageSetAccessToken,
|
||||
@@ -21,8 +23,6 @@ const listeners = (
|
||||
</>
|
||||
);
|
||||
|
||||
import App from "./App";
|
||||
|
||||
interface Props {
|
||||
disableListeners?: boolean;
|
||||
local: Local;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Icon, MatchMedia, Tab, TabBar } from "coral-ui/components";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { FunctionComponent } from "react";
|
||||
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Icon, MatchMedia, Tab, TabBar } from "coral-ui/components";
|
||||
|
||||
type TabValue = "COMMENTS" | "PROFILE" | "%future added value";
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ import {
|
||||
withFragmentContainer,
|
||||
withLocalStateContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { Ability, can } from "coral-stream/permissions";
|
||||
|
||||
import { TabBarContainer_viewer as ViewerData } from "coral-stream/__generated__/TabBarContainer_viewer.graphql";
|
||||
import { TabBarContainerLocal as Local } from "coral-stream/__generated__/TabBarContainerLocal.graphql";
|
||||
import { Ability, can } from "coral-stream/permissions";
|
||||
|
||||
import {
|
||||
SetActiveTabInput,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React, { Component } from "react";
|
||||
|
||||
import {
|
||||
graphql,
|
||||
QueryRenderer,
|
||||
withLocalStateContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import React, { Component } from "react";
|
||||
|
||||
import { TabBarQuery as QueryTypes } from "coral-stream/__generated__/TabBarQuery.graphql";
|
||||
import { TabBarQueryLocal as Local } from "coral-stream/__generated__/TabBarQueryLocal.graphql";
|
||||
|
||||
@@ -13,7 +13,7 @@ export class OnPostMessageSetAccessToken extends Component<Props> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
// Auth popup will use this to handle a successful login.
|
||||
props.postMessage!.on("setAccessToken", (accessToken: string) => {
|
||||
props.postMessage.on("setAccessToken", (accessToken: string) => {
|
||||
props.setAccessToken({ accessToken });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export class OnPymLogin extends Component<Props> {
|
||||
super(props);
|
||||
|
||||
// Sets comment id through pym.
|
||||
props.pym!.onMessage("login", accessToken => {
|
||||
props.pym.onMessage("login", accessToken => {
|
||||
this.props.setAccessToken({ accessToken });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {
|
||||
SignOutMutation,
|
||||
withSignOutMutation,
|
||||
} from "coral-framework/mutations";
|
||||
import { Child } from "pym.js";
|
||||
import { Component } from "react";
|
||||
|
||||
import { withContext } from "coral-framework/lib/bootstrap";
|
||||
import {
|
||||
SignOutMutation,
|
||||
withSignOutMutation,
|
||||
} from "coral-framework/mutations";
|
||||
|
||||
interface Props {
|
||||
pym: Child;
|
||||
@@ -17,7 +17,7 @@ export class OnPymLogout extends Component<Props> {
|
||||
super(props);
|
||||
|
||||
// Sets comment id through pym.
|
||||
props.pym!.onMessage("logout", accessToken => {
|
||||
props.pym.onMessage("logout", accessToken => {
|
||||
this.props.signOut();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class OnPymSetCommentID extends Component<Props> {
|
||||
super(props);
|
||||
|
||||
// Sets comment id through pym.
|
||||
props.pym!.onMessage("setCommentID", raw => {
|
||||
props.pym.onMessage("setCommentID", raw => {
|
||||
commitLocalUpdate(this.props.relayEnvironment, s => {
|
||||
const id = raw || null;
|
||||
if (s.get(LOCAL_ID)!.getValue("commentID") !== id) {
|
||||
|
||||
@@ -15,7 +15,7 @@ it("sanitizes evil html", () => {
|
||||
<HTMLContent>
|
||||
{`
|
||||
<script>alert('I am evil')</script>
|
||||
<span onClick=\"javascript:alert('haha')\" title="test">Hello world</span>
|
||||
<span onClick="javascript:alert('haha')" title="test">Hello world</span>
|
||||
`}
|
||||
</HTMLContent>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import cn from "classnames";
|
||||
import { withStyles } from "coral-ui/hocs";
|
||||
import React, { FunctionComponent, ReactNode } from "react";
|
||||
|
||||
import { withStyles } from "coral-ui/hocs";
|
||||
|
||||
import styles from "./MessageBox.css";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
createMutation,
|
||||
createMutationContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
|
||||
import { AUTH_POPUP_ID } from "coral-stream/local";
|
||||
|
||||
export interface SetAuthPopupStateInput {
|
||||
|
||||
@@ -56,11 +56,11 @@ it("renders fully", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
showAuthPopup: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
setAuthPopupState: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
signOut: async () => {},
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
@@ -115,11 +115,11 @@ it("renders without logout button", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
showAuthPopup: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
setAuthPopupState: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
signOut: async () => {},
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
@@ -174,11 +174,11 @@ it("renders sso only", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
showAuthPopup: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
setAuthPopupState: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
signOut: async () => {},
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
@@ -233,11 +233,11 @@ it("renders sso only without logout button", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
showAuthPopup: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
setAuthPopupState: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
signOut: async () => {},
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
@@ -292,11 +292,11 @@ it("renders without register button", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
showAuthPopup: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
setAuthPopupState: async () => {},
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
signOut: async () => {},
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
|
||||
@@ -10,15 +10,16 @@ import {
|
||||
SignOutMutation,
|
||||
withSignOutMutation,
|
||||
} from "coral-framework/mutations";
|
||||
import { UserBoxContainer_settings as SettingsData } from "coral-stream/__generated__/UserBoxContainer_settings.graphql";
|
||||
import { UserBoxContainer_viewer as ViewerData } from "coral-stream/__generated__/UserBoxContainer_viewer.graphql";
|
||||
import { UserBoxContainerLocal as Local } from "coral-stream/__generated__/UserBoxContainerLocal.graphql";
|
||||
import {
|
||||
ShowAuthPopupMutation,
|
||||
withShowAuthPopupMutation,
|
||||
} from "coral-stream/mutations";
|
||||
import { Popup } from "coral-ui/components";
|
||||
|
||||
import { UserBoxContainer_settings as SettingsData } from "coral-stream/__generated__/UserBoxContainer_settings.graphql";
|
||||
import { UserBoxContainer_viewer as ViewerData } from "coral-stream/__generated__/UserBoxContainer_viewer.graphql";
|
||||
import { UserBoxContainerLocal as Local } from "coral-stream/__generated__/UserBoxContainerLocal.graphql";
|
||||
|
||||
import {
|
||||
SetAuthPopupStateMutation,
|
||||
withSetAuthPopupStateMutation,
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
*/
|
||||
|
||||
import { LocalesData } from "coral-framework/lib/i18n";
|
||||
|
||||
export default {} as LocalesData;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Environment, RecordSource } from "relay-runtime";
|
||||
import sinon from "sinon";
|
||||
|
||||
import { timeout } from "coral-common/utils";
|
||||
import { parseQuery } from "coral-common/utils";
|
||||
import { parseQuery, timeout } from "coral-common/utils";
|
||||
import { LOCAL_ID } from "coral-framework/lib/relay";
|
||||
import { createRelayEnvironment } from "coral-framework/testHelpers";
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@ import { commitLocalUpdate, Environment } from "relay-runtime";
|
||||
|
||||
import { getURLWithCommentID } from "coral-framework/helpers";
|
||||
import { CoralContext } from "coral-framework/lib/bootstrap";
|
||||
import { createMutationContainer } from "coral-framework/lib/relay";
|
||||
import { LOCAL_ID } from "coral-framework/lib/relay";
|
||||
import { createMutationContainer, LOCAL_ID } from "coral-framework/lib/relay";
|
||||
|
||||
export interface SetCommentIDInput {
|
||||
id: string | null;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLUSER_ROLE, GQLUSER_ROLE_RL } from "coral-framework/schema";
|
||||
import { mapValues } from "lodash";
|
||||
|
||||
import { GQLUSER_ROLE, GQLUSER_ROLE_RL } from "coral-framework/schema";
|
||||
|
||||
/**
|
||||
* permissionMap describes what abilities certain roles have.
|
||||
*
|
||||
@@ -20,7 +21,7 @@ const permissionMap = {
|
||||
|
||||
export type AbilityType = keyof typeof permissionMap;
|
||||
export const Ability = mapValues(permissionMap, (_, key) => key) as {
|
||||
[P in AbilityType]: P
|
||||
[P in AbilityType]: P;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,10 +2,10 @@ import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import withFragmentContainer from "coral-framework/lib/relay/withFragmentContainer";
|
||||
import { AuthorBadgesContainer_comment as CommentData } from "coral-stream/__generated__/AuthorBadgesContainer_comment.graphql";
|
||||
|
||||
import { Tag } from "coral-ui/components";
|
||||
|
||||
import { AuthorBadgesContainer_comment as CommentData } from "coral-stream/__generated__/AuthorBadgesContainer_comment.graphql";
|
||||
|
||||
interface Props {
|
||||
comment: CommentData;
|
||||
className?: string;
|
||||
|
||||
@@ -8,10 +8,6 @@ import { getURLWithCommentID } from "coral-framework/helpers";
|
||||
import withFragmentContainer from "coral-framework/lib/relay/withFragmentContainer";
|
||||
import { GQLTAG, GQLUSER_STATUS } from "coral-framework/schema";
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
import { CommentContainer_comment as CommentData } from "coral-stream/__generated__/CommentContainer_comment.graphql";
|
||||
import { CommentContainer_settings as SettingsData } from "coral-stream/__generated__/CommentContainer_settings.graphql";
|
||||
import { CommentContainer_story as StoryData } from "coral-stream/__generated__/CommentContainer_story.graphql";
|
||||
import { CommentContainer_viewer as ViewerData } from "coral-stream/__generated__/CommentContainer_viewer.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import {
|
||||
SetCommentIDMutation,
|
||||
@@ -22,6 +18,11 @@ import {
|
||||
import { Ability, can } from "coral-stream/permissions";
|
||||
import { Button, Flex, HorizontalGutter, Tag } from "coral-ui/components";
|
||||
|
||||
import { CommentContainer_comment as CommentData } from "coral-stream/__generated__/CommentContainer_comment.graphql";
|
||||
import { CommentContainer_settings as SettingsData } from "coral-stream/__generated__/CommentContainer_settings.graphql";
|
||||
import { CommentContainer_story as StoryData } from "coral-stream/__generated__/CommentContainer_story.graphql";
|
||||
import { CommentContainer_viewer as ViewerData } from "coral-stream/__generated__/CommentContainer_viewer.graphql";
|
||||
|
||||
import { isPublished } from "../helpers";
|
||||
import UserBadgesContainer from "./AuthorBadgesContainer";
|
||||
import ButtonsBar from "./ButtonsBar";
|
||||
@@ -308,9 +309,7 @@ export class CommentContainer extends Component<Props, State> {
|
||||
!suspended &&
|
||||
!scheduledForDeletion && (
|
||||
<ReplyButton
|
||||
id={`comments-commentContainer-replyButton-${
|
||||
comment.id
|
||||
}`}
|
||||
id={`comments-commentContainer-replyButton-${comment.id}`}
|
||||
onClick={this.toggleReplyDialog}
|
||||
active={showReplyDialog}
|
||||
disabled={
|
||||
@@ -342,9 +341,7 @@ export class CommentContainer extends Component<Props, State> {
|
||||
{showConversationLink && (
|
||||
<ShowConversationLink
|
||||
className={CLASSES.comment.readMoreOfConversation}
|
||||
id={`comments-commentContainer-showConversation-${
|
||||
comment.id
|
||||
}`}
|
||||
id={`comments-commentContainer-showConversation-${comment.id}`}
|
||||
onClick={this.handleShowConversation}
|
||||
href={getURLWithCommentID(
|
||||
this.props.story.url,
|
||||
|
||||
+2
-2
@@ -10,11 +10,11 @@ import {
|
||||
withFetch,
|
||||
withFragmentContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
|
||||
import { EditCommentFormContainer_comment as CommentData } from "coral-stream/__generated__/EditCommentFormContainer_comment.graphql";
|
||||
import { EditCommentFormContainer_settings as SettingsData } from "coral-stream/__generated__/EditCommentFormContainer_settings.graphql";
|
||||
import { EditCommentFormContainer_story as StoryData } from "coral-stream/__generated__/EditCommentFormContainer_story.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
|
||||
import {
|
||||
getSubmitStatus,
|
||||
@@ -111,7 +111,7 @@ export class EditCommentFormContainer extends Component<Props, State> {
|
||||
}
|
||||
return error.invalidArgs;
|
||||
}
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -2,6 +2,7 @@ import { pick } from "lodash";
|
||||
import { graphql } from "react-relay";
|
||||
import { Environment } from "relay-runtime";
|
||||
|
||||
import { CoralContext } from "coral-framework/lib/bootstrap";
|
||||
import {
|
||||
commitMutationPromiseNormalized,
|
||||
createMutationContainer,
|
||||
@@ -9,9 +10,8 @@ import {
|
||||
MutationInput,
|
||||
MutationResponsePromise,
|
||||
} from "coral-framework/lib/relay";
|
||||
|
||||
import { CoralContext } from "coral-framework/lib/bootstrap";
|
||||
import { GQLComment } from "coral-framework/schema";
|
||||
|
||||
import { EditCommentMutation as MutationTypes } from "coral-stream/__generated__/EditCommentMutation.graphql";
|
||||
|
||||
export type EditCommentInput = MutationInput<MutationTypes>;
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ import {
|
||||
MutationInput,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLCOMMENT_STATUS } from "coral-framework/schema";
|
||||
|
||||
import { ApproveCommentMutation as MutationTypes } from "coral-stream/__generated__/ApproveCommentMutation.graphql";
|
||||
|
||||
let clientMutationId = 0;
|
||||
|
||||
@@ -4,11 +4,12 @@ import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Button, ClickOutside, Icon, Popover } from "coral-ui/components";
|
||||
|
||||
import { CaretContainer_comment } from "coral-stream/__generated__/CaretContainer_comment.graphql";
|
||||
import { CaretContainer_story } from "coral-stream/__generated__/CaretContainer_story.graphql";
|
||||
import { CaretContainer_viewer } from "coral-stream/__generated__/CaretContainer_viewer.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Button, ClickOutside, Icon, Popover } from "coral-ui/components";
|
||||
|
||||
import ModerationDropdownContainer from "./ModerationDropdownContainer";
|
||||
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ import {
|
||||
MutationInput,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLCOMMENT_STATUS, GQLTAG } from "coral-framework/schema";
|
||||
|
||||
import { FeatureCommentMutation as MutationTypes } from "coral-stream/__generated__/FeatureCommentMutation.graphql";
|
||||
|
||||
let clientMutationId = 0;
|
||||
|
||||
+2
-1
@@ -4,11 +4,12 @@ import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { ModerationActionBanContainer_user } from "coral-stream/__generated__/ModerationActionBanContainer_user.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import Spinner from "coral-stream/common/Spinner";
|
||||
import { DropdownButton, Icon } from "coral-ui/components";
|
||||
|
||||
import { ModerationActionBanContainer_user } from "coral-stream/__generated__/ModerationActionBanContainer_user.graphql";
|
||||
|
||||
import styles from "./ModerationActionBanContainer.css";
|
||||
|
||||
interface Props {
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
import { graphql, QueryRenderer } from "coral-framework/lib/relay";
|
||||
import React, { Component } from "react";
|
||||
|
||||
import { graphql, QueryRenderer } from "coral-framework/lib/relay";
|
||||
|
||||
import { ModerationActionBanQuery as QueryTypes } from "coral-stream/__generated__/ModerationActionBanQuery.graphql";
|
||||
|
||||
import ModerationActionBanContainer from "./ModerationActionBanContainer";
|
||||
|
||||
+4
-3
@@ -4,11 +4,12 @@ import React, { FunctionComponent, useCallback } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { useMutation, withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { DropdownButton, DropdownDivider, Icon } from "coral-ui/components";
|
||||
|
||||
import { ModerationActionsContainer_comment } from "coral-stream/__generated__/ModerationActionsContainer_comment.graphql";
|
||||
import { ModerationActionsContainer_story } from "coral-stream/__generated__/ModerationActionsContainer_story.graphql";
|
||||
import { ModerationActionsContainer_viewer } from "coral-stream/__generated__/ModerationActionsContainer_viewer.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { DropdownButton, DropdownDivider, Icon } from "coral-ui/components";
|
||||
|
||||
import ApproveCommentMutation from "./ApproveCommentMutation";
|
||||
import FeatureCommentMutation from "./FeatureCommentMutation";
|
||||
@@ -78,7 +79,7 @@ const ModerationActionsContainer: FunctionComponent<Props> = ({
|
||||
const showBanOption =
|
||||
!comment.author || !comment.author.id || viewer === null
|
||||
? false
|
||||
: comment.author!.id !== viewer.id;
|
||||
: comment.author.id !== viewer.id;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
+3
-2
@@ -2,11 +2,12 @@ import React, { FunctionComponent, useCallback, useState } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Dropdown } from "coral-ui/components";
|
||||
|
||||
import { ModerationDropdownContainer_comment } from "coral-stream/__generated__/ModerationDropdownContainer_comment.graphql";
|
||||
import { ModerationDropdownContainer_story } from "coral-stream/__generated__/ModerationDropdownContainer_story.graphql";
|
||||
import { ModerationDropdownContainer_viewer } from "coral-stream/__generated__/ModerationDropdownContainer_viewer.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Dropdown } from "coral-ui/components";
|
||||
|
||||
import UserBanPopoverContainer from "../UserBanPopover/UserBanPopoverContainer";
|
||||
import ModerationActionsContainer from "./ModerationActionsContainer";
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ import {
|
||||
MutationInput,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLCOMMENT_STATUS } from "coral-framework/schema";
|
||||
|
||||
import { RejectCommentMutation as MutationTypes } from "coral-stream/__generated__/RejectCommentMutation.graphql";
|
||||
|
||||
let clientMutationId = 0;
|
||||
|
||||
+2
-1
@@ -3,10 +3,11 @@ import React, { FunctionComponent, useMemo } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { RejectedTombstoneContainer_comment as CommentData } from "coral-stream/__generated__/RejectedTombstoneContainer_comment.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { CallOut, TextLink } from "coral-ui/components";
|
||||
|
||||
import { RejectedTombstoneContainer_comment as CommentData } from "coral-stream/__generated__/RejectedTombstoneContainer_comment.graphql";
|
||||
|
||||
interface Props {
|
||||
comment: CommentData;
|
||||
}
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ import {
|
||||
MutationInput,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLTAG } from "coral-framework/schema";
|
||||
|
||||
import { UnfeatureCommentMutation as MutationTypes } from "coral-stream/__generated__/UnfeatureCommentMutation.graphql";
|
||||
|
||||
let clientMutationId = 0;
|
||||
|
||||
+5
-3
@@ -1,9 +1,11 @@
|
||||
import { getURLWithCommentID } from "coral-framework/helpers";
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { PermalinkButtonContainer_story as StoryData } from "coral-stream/__generated__/PermalinkButtonContainer_story.graphql";
|
||||
import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { getURLWithCommentID } from "coral-framework/helpers";
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import { PermalinkButtonContainer_story as StoryData } from "coral-stream/__generated__/PermalinkButtonContainer_story.graphql";
|
||||
|
||||
import PermalinkButton from "./PermalinkButton";
|
||||
|
||||
interface Props {
|
||||
|
||||
+1
-1
@@ -9,8 +9,8 @@ import {
|
||||
MutationInput,
|
||||
MutationResponsePromise,
|
||||
} from "coral-framework/lib/relay";
|
||||
|
||||
import { GQLComment } from "coral-framework/schema";
|
||||
|
||||
import { CreateCommentReactionMutation as MutationTypes } from "coral-stream/__generated__/CreateCommentReactionMutation.graphql";
|
||||
|
||||
export type CreateCommentReactionInput = MutationInput<MutationTypes>;
|
||||
|
||||
+7
-6
@@ -1,26 +1,27 @@
|
||||
import cn from "classnames";
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { ReactionButtonContainer_comment as CommentData } from "coral-stream/__generated__/ReactionButtonContainer_comment.graphql";
|
||||
import { ReactionButtonContainer_settings as SettingsData } from "coral-stream/__generated__/ReactionButtonContainer_settings.graphql";
|
||||
import { ReactionButtonContainer_viewer as ViewerData } from "coral-stream/__generated__/ReactionButtonContainer_viewer.graphql";
|
||||
import React from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import {
|
||||
ShowAuthPopupMutation,
|
||||
withShowAuthPopupMutation,
|
||||
} from "coral-stream/mutations";
|
||||
|
||||
import { ReactionButtonContainer_comment as CommentData } from "coral-stream/__generated__/ReactionButtonContainer_comment.graphql";
|
||||
import { ReactionButtonContainer_settings as SettingsData } from "coral-stream/__generated__/ReactionButtonContainer_settings.graphql";
|
||||
import { ReactionButtonContainer_viewer as ViewerData } from "coral-stream/__generated__/ReactionButtonContainer_viewer.graphql";
|
||||
|
||||
import {
|
||||
CreateCommentReactionMutation,
|
||||
withCreateCommentReactionMutation,
|
||||
} from "./CreateCommentReactionMutation";
|
||||
import ReactionButton from "./ReactionButton";
|
||||
import {
|
||||
RemoveCommentReactionMutation,
|
||||
withRemoveCommentReactionMutation,
|
||||
} from "./RemoveCommentReactionMutation";
|
||||
|
||||
import ReactionButton from "./ReactionButton";
|
||||
|
||||
interface Props {
|
||||
createCommentReaction: CreateCommentReactionMutation;
|
||||
removeCommentReaction: RemoveCommentReactionMutation;
|
||||
|
||||
+1
-1
@@ -9,8 +9,8 @@ import {
|
||||
MutationInput,
|
||||
MutationResponsePromise,
|
||||
} from "coral-framework/lib/relay";
|
||||
|
||||
import { GQLComment } from "coral-framework/schema";
|
||||
|
||||
import { RemoveCommentReactionMutation as MutationTypes } from "coral-stream/__generated__/RemoveCommentReactionMutation.graphql";
|
||||
|
||||
export type RemoveCommentReactionInput = MutationInput<MutationTypes>;
|
||||
|
||||
+6
-6
@@ -1,3 +1,4 @@
|
||||
import { pick } from "lodash";
|
||||
import { graphql } from "react-relay";
|
||||
import {
|
||||
ConnectionHandler,
|
||||
@@ -6,8 +7,7 @@ import {
|
||||
RecordSourceSelectorProxy,
|
||||
} from "relay-runtime";
|
||||
|
||||
import { getViewer } from "coral-framework/helpers";
|
||||
import { roleIsAtLeast } from "coral-framework/helpers";
|
||||
import { getViewer, roleIsAtLeast } from "coral-framework/helpers";
|
||||
import { CoralContext } from "coral-framework/lib/bootstrap";
|
||||
import {
|
||||
commitMutationPromiseNormalized,
|
||||
@@ -17,9 +17,9 @@ import {
|
||||
MutationResponsePromise,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLComment, GQLStory, GQLUSER_ROLE } from "coral-framework/schema";
|
||||
|
||||
import { CreateCommentReplyMutation as MutationTypes } from "coral-stream/__generated__/CreateCommentReplyMutation.graphql";
|
||||
|
||||
import { pick } from "lodash";
|
||||
import {
|
||||
incrementStoryCommentCounts,
|
||||
isPublished,
|
||||
@@ -90,7 +90,7 @@ function addLocalCommentReplyToStory(
|
||||
const newComment = commentEdge.getLinkedRecord("node");
|
||||
|
||||
// Get parent proxy.
|
||||
const parentProxy = store.get(input.parentID!);
|
||||
const parentProxy = store.get(input.parentID);
|
||||
|
||||
if (parentProxy) {
|
||||
const localReplies = parentProxy.getLinkedRecords("localReplies");
|
||||
@@ -102,7 +102,7 @@ function addLocalCommentReplyToStory(
|
||||
}
|
||||
|
||||
/** These are needed to be included when querying for the stream. */
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
graphql`
|
||||
fragment CreateCommentReplyMutation_story on Story {
|
||||
settings {
|
||||
@@ -110,7 +110,7 @@ graphql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
graphql`
|
||||
fragment CreateCommentReplyMutation_viewer on User {
|
||||
role
|
||||
|
||||
+2
-2
@@ -4,11 +4,11 @@ import React from "react";
|
||||
import { createRenderer } from "react-test-renderer/shallow";
|
||||
import sinon from "sinon";
|
||||
|
||||
import { timeout } from "coral-common/utils";
|
||||
import { pureMerge } from "coral-common/utils";
|
||||
import { pureMerge, timeout } from "coral-common/utils";
|
||||
import { createPromisifiedStorage } from "coral-framework/lib/storage";
|
||||
import { removeFragmentRefs, wait } from "coral-framework/testHelpers";
|
||||
import { DeepPartial, PropTypesOf } from "coral-framework/types";
|
||||
|
||||
import { ReplyCommentFormContainer } from "./ReplyCommentFormContainer";
|
||||
|
||||
const ReplyCommentFormContainerN = removeFragmentRefs(
|
||||
|
||||
+3
-2
@@ -14,10 +14,11 @@ import {
|
||||
withFragmentContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { PromisifiedStorage } from "coral-framework/lib/storage";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
|
||||
import { ReplyCommentFormContainer_comment as CommentData } from "coral-stream/__generated__/ReplyCommentFormContainer_comment.graphql";
|
||||
import { ReplyCommentFormContainer_settings as SettingsData } from "coral-stream/__generated__/ReplyCommentFormContainer_settings.graphql";
|
||||
import { ReplyCommentFormContainer_story as StoryData } from "coral-stream/__generated__/ReplyCommentFormContainer_story.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
|
||||
import {
|
||||
getSubmitStatus,
|
||||
@@ -140,7 +141,7 @@ export class ReplyCommentFormContainer extends Component<Props, State> {
|
||||
this.disableNudge();
|
||||
return { [FORM_ERROR]: error.message };
|
||||
}
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -15,12 +15,13 @@ interface Props {
|
||||
onDismiss: () => void;
|
||||
}
|
||||
|
||||
function getMessage(status: SubmitStatus, inReviewClassName: string = "") {
|
||||
function getMessage(status: SubmitStatus, inReviewClassName = "") {
|
||||
switch (status) {
|
||||
case "RETRY":
|
||||
throw new Error(`Invalid status ${status}`);
|
||||
case "REJECTED":
|
||||
// TODO: Show a different message when rejected?
|
||||
// falls through
|
||||
case "IN_REVIEW":
|
||||
return (
|
||||
<Localized id="comments-submitStatus-submittedAndWillBeReviewed">
|
||||
|
||||
@@ -3,17 +3,17 @@ import React from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import {
|
||||
ShowAuthPopupMutation,
|
||||
withShowAuthPopupMutation,
|
||||
} from "coral-stream/mutations";
|
||||
|
||||
import { ReportButtonContainer_comment as CommentData } from "coral-stream/__generated__/ReportButtonContainer_comment.graphql";
|
||||
import { ReportButtonContainer_viewer as ViewerData } from "coral-stream/__generated__/ReportButtonContainer_viewer.graphql";
|
||||
|
||||
import ReportButton from "./ReportButton";
|
||||
import ReportButtonWithPopover from "./ReportButtonWithPopover";
|
||||
|
||||
import {
|
||||
ShowAuthPopupMutation,
|
||||
withShowAuthPopupMutation,
|
||||
} from "coral-stream/mutations";
|
||||
|
||||
interface ReportButtonContainerProps {
|
||||
comment: CommentData;
|
||||
viewer: ViewerData | null;
|
||||
|
||||
+2
-3
@@ -1,13 +1,12 @@
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React from "react";
|
||||
|
||||
import { ClickOutside, Popover } from "coral-ui/components";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import { PropTypesOf } from "coral-ui/types";
|
||||
|
||||
import ReportPopover from "../ReportPopover";
|
||||
import ReportButton from "./ReportButton";
|
||||
|
||||
import { PropTypesOf } from "coral-ui/types";
|
||||
|
||||
interface Props {
|
||||
comment: { id: string } & PropTypesOf<typeof ReportPopover>["comment"];
|
||||
reported: boolean;
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import { graphql } from "react-relay";
|
||||
import { InvalidRequestError } from "coral-framework/lib/errors";
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
|
||||
import { ReportCommentFormContainer_comment as CommentData } from "coral-stream/__generated__/ReportCommentFormContainer_comment.graphql";
|
||||
|
||||
import {
|
||||
@@ -59,7 +60,7 @@ export class ReportCommentFormContainer extends Component<Props, State> {
|
||||
if (error instanceof InvalidRequestError) {
|
||||
return error.invalidArgs;
|
||||
}
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
}
|
||||
return undefined;
|
||||
|
||||
@@ -6,6 +6,7 @@ import { BaseButton, Icon } from "coral-ui/components";
|
||||
import { PropTypesOf } from "coral-ui/types";
|
||||
|
||||
import ReportCommentFormContainer from "./ReportCommentFormContainer";
|
||||
|
||||
import styles from "./ReportPopover.css";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import React, { EventHandler, MouseEvent } from "react";
|
||||
import { FunctionComponent } from "react";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { EventHandler, FunctionComponent, MouseEvent } from "react";
|
||||
|
||||
import { Button } from "coral-ui/components";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
|
||||
export interface ShowConversationLinkProps {
|
||||
id?: string;
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
createMutation,
|
||||
MutationInput,
|
||||
} from "coral-framework/lib/relay";
|
||||
|
||||
import { BanUserMutation } from "coral-stream/__generated__/BanUserMutation.graphql";
|
||||
|
||||
let clientMutationId = 0;
|
||||
|
||||
+3
-2
@@ -6,11 +6,12 @@ import { graphql } from "react-relay";
|
||||
import { useCoralContext } from "coral-framework/lib/bootstrap";
|
||||
import { getMessage } from "coral-framework/lib/i18n";
|
||||
import { useMutation, withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { UserBanPopoverContainer_comment } from "coral-stream/__generated__/UserBanPopoverContainer_comment.graphql";
|
||||
import { UserBanPopoverContainer_story } from "coral-stream/__generated__/UserBanPopoverContainer_story.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Box, Button, Flex, Typography } from "coral-ui/components";
|
||||
|
||||
import { UserBanPopoverContainer_comment } from "coral-stream/__generated__/UserBanPopoverContainer_comment.graphql";
|
||||
import { UserBanPopoverContainer_story } from "coral-stream/__generated__/UserBanPopoverContainer_story.graphql";
|
||||
|
||||
import RejectCommentMutation from "../ModerationDropdown/RejectCommentMutation";
|
||||
import BanUserMutation from "./BanUserMutation";
|
||||
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import {
|
||||
createMutation,
|
||||
MutationInput,
|
||||
} from "coral-framework/lib/relay";
|
||||
|
||||
import { IgnoreUserMutation as MutationTypes } from "coral-stream/__generated__/IgnoreUserMutation.graphql";
|
||||
|
||||
let clientMutationId = 0;
|
||||
@@ -34,7 +35,7 @@ const IgnoreUserMutation = createMutation(
|
||||
const ignoredUserRecords = viewerProxy.getLinkedRecords("ignoredUsers");
|
||||
if (ignoredUserRecords) {
|
||||
viewerProxy.setLinkedRecords(
|
||||
ignoredUserRecords.concat(store.get(input.userID)!),
|
||||
ignoredUserRecords.concat(store.get(input.userID)),
|
||||
"ignoredUsers"
|
||||
);
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,15 +1,16 @@
|
||||
import cn from "classnames";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { FunctionComponent, useCallback } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { useMutation, withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { UserIgnorePopoverContainer_user as UserData } from "coral-stream/__generated__/UserIgnorePopoverContainer_user.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Box, Button, Flex, Typography } from "coral-ui/components";
|
||||
|
||||
import { UserIgnorePopoverContainer_user as UserData } from "coral-stream/__generated__/UserIgnorePopoverContainer_user.graphql";
|
||||
|
||||
import IgnoreUserMutation from "./IgnoreUserMutation";
|
||||
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import styles from "./UserIgnorePopoverContainer.css";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -2,6 +2,7 @@ import React, { FunctionComponent, useCallback, useState } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import { UserPopoverContainer_user as UserData } from "coral-stream/__generated__/UserPopoverContainer_user.graphql";
|
||||
import { UserPopoverContainer_viewer as ViewerData } from "coral-stream/__generated__/UserPopoverContainer_viewer.graphql";
|
||||
|
||||
|
||||
+4
-3
@@ -4,8 +4,6 @@ import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { UserPopoverOverviewContainer_user as UserData } from "coral-stream/__generated__/UserPopoverOverviewContainer_user.graphql";
|
||||
import { UserPopoverOverviewContainer_viewer as ViewerData } from "coral-stream/__generated__/UserPopoverOverviewContainer_viewer.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import {
|
||||
Button,
|
||||
@@ -14,6 +12,9 @@ import {
|
||||
Typography,
|
||||
} from "coral-ui/components";
|
||||
|
||||
import { UserPopoverOverviewContainer_user as UserData } from "coral-stream/__generated__/UserPopoverOverviewContainer_user.graphql";
|
||||
import { UserPopoverOverviewContainer_viewer as ViewerData } from "coral-stream/__generated__/UserPopoverOverviewContainer_viewer.graphql";
|
||||
|
||||
import Username from "../Username";
|
||||
|
||||
import styles from "./UserPopoverOverviewContainer.css";
|
||||
@@ -42,7 +43,7 @@ export const UserPopoverOverviewContainer: FunctionComponent<Props> = ({
|
||||
<HorizontalGutter spacing={2}>
|
||||
<div>
|
||||
<Username className={CLASSES.userPopover.username}>
|
||||
{user.username!}
|
||||
{user.username}
|
||||
</Username>
|
||||
</div>
|
||||
<Localized
|
||||
|
||||
@@ -2,9 +2,10 @@ import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import withFragmentContainer from "coral-framework/lib/relay/withFragmentContainer";
|
||||
import { Tag } from "coral-ui/components";
|
||||
|
||||
import { UserTagsContainer_comment } from "coral-stream/__generated__/UserTagsContainer_comment.graphql";
|
||||
import { UserTagsContainer_settings } from "coral-stream/__generated__/UserTagsContainer_settings.graphql";
|
||||
import { Tag } from "coral-ui/components";
|
||||
|
||||
interface Props {
|
||||
comment: UserTagsContainer_comment;
|
||||
|
||||
+3
-2
@@ -3,9 +3,10 @@ import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { BaseButton, ClickOutside, Popover } from "coral-ui/components";
|
||||
|
||||
import { UsernameWithPopoverContainer_user as UserData } from "coral-stream/__generated__/UsernameWithPopoverContainer_user.graphql";
|
||||
import { UsernameWithPopoverContainer_viewer as ViewerData } from "coral-stream/__generated__/UsernameWithPopoverContainer_viewer.graphql";
|
||||
import { BaseButton, ClickOutside, Popover } from "coral-ui/components";
|
||||
|
||||
import UserPopoverContainer from "../UserPopover";
|
||||
import Username from "./Username";
|
||||
@@ -41,7 +42,7 @@ const UsernameWithPopoverContainer: FunctionComponent<Props> = props => {
|
||||
ref={ref}
|
||||
className={props.className}
|
||||
>
|
||||
<Username>{props.user.username!}</Username>
|
||||
<Username>{props.user.username}</Username>
|
||||
</BaseButton>
|
||||
)}
|
||||
</Popover>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { FunctionComponent } from "react";
|
||||
|
||||
import { graphql, useLocal } from "coral-framework/lib/relay";
|
||||
|
||||
import { CommentsPaneLocal } from "coral-stream/__generated__/CommentsPaneLocal.graphql";
|
||||
|
||||
import PermalinkView from "./PermalinkView";
|
||||
|
||||
@@ -8,11 +8,12 @@ import React, {
|
||||
|
||||
import { usePrevious } from "coral-framework/hooks";
|
||||
import { graphql, withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { IgnoredTombstoneOrHideContainer_comment as CommentData } from "coral-stream/__generated__/IgnoredTombstoneOrHideContainer_comment.graphql";
|
||||
import { IgnoredTombstoneOrHideContainer_viewer as ViewerData } from "coral-stream/__generated__/IgnoredTombstoneOrHideContainer_viewer.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { CallOut } from "coral-ui/components";
|
||||
|
||||
import { IgnoredTombstoneOrHideContainer_comment as CommentData } from "coral-stream/__generated__/IgnoredTombstoneOrHideContainer_comment.graphql";
|
||||
import { IgnoredTombstoneOrHideContainer_viewer as ViewerData } from "coral-stream/__generated__/IgnoredTombstoneOrHideContainer_viewer.graphql";
|
||||
|
||||
interface Props {
|
||||
viewer: ViewerData | null;
|
||||
comment: CommentData;
|
||||
@@ -22,6 +23,7 @@ interface Props {
|
||||
/**
|
||||
* useTombstone is a React hook that determines whether or not
|
||||
* to show a tombstone instead of hiding the comment.
|
||||
*
|
||||
* @param hide boolean if comment should be hidden
|
||||
*/
|
||||
const useTombstone = (hide: boolean) => {
|
||||
|
||||
@@ -22,7 +22,7 @@ const levels = [
|
||||
styles.level6,
|
||||
];
|
||||
|
||||
function getLevelClassName(level: number = 0) {
|
||||
function getLevelClassName(level = 0) {
|
||||
if (!(level in levels)) {
|
||||
throw new Error(`Indent level ${level} does not exist`);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,6 @@ import { graphql, RelayPaginationProp } from "react-relay";
|
||||
|
||||
import { withContext } from "coral-framework/lib/bootstrap";
|
||||
import { withPaginationContainer } from "coral-framework/lib/relay";
|
||||
import { ConversationThreadContainer_comment as CommentData } from "coral-stream/__generated__/ConversationThreadContainer_comment.graphql";
|
||||
import { ConversationThreadContainer_settings as SettingsData } from "coral-stream/__generated__/ConversationThreadContainer_settings.graphql";
|
||||
import { ConversationThreadContainer_story as StoryData } from "coral-stream/__generated__/ConversationThreadContainer_story.graphql";
|
||||
import { ConversationThreadContainer_viewer as ViewerData } from "coral-stream/__generated__/ConversationThreadContainer_viewer.graphql";
|
||||
import { ConversationThreadContainerPaginationQueryVariables } from "coral-stream/__generated__/ConversationThreadContainerPaginationQuery.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import Counter from "coral-stream/common/Counter";
|
||||
import {
|
||||
@@ -25,6 +20,12 @@ import {
|
||||
import LocalReplyListContainer from "coral-stream/tabs/Comments/ReplyList/LocalReplyListContainer";
|
||||
import { Button, Flex, HorizontalGutter } from "coral-ui/components";
|
||||
|
||||
import { ConversationThreadContainer_comment as CommentData } from "coral-stream/__generated__/ConversationThreadContainer_comment.graphql";
|
||||
import { ConversationThreadContainer_settings as SettingsData } from "coral-stream/__generated__/ConversationThreadContainer_settings.graphql";
|
||||
import { ConversationThreadContainer_story as StoryData } from "coral-stream/__generated__/ConversationThreadContainer_story.graphql";
|
||||
import { ConversationThreadContainer_viewer as ViewerData } from "coral-stream/__generated__/ConversationThreadContainer_viewer.graphql";
|
||||
import { ConversationThreadContainerPaginationQueryVariables } from "coral-stream/__generated__/ConversationThreadContainerPaginationQuery.graphql";
|
||||
|
||||
import { Circle, Line } from "./Timeline";
|
||||
|
||||
import styles from "./ConversationThreadContainer.css";
|
||||
@@ -56,7 +57,7 @@ class ConversationThreadContainer extends React.Component<
|
||||
error => {
|
||||
this.setState({ disableLoadMore: false });
|
||||
if (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ import { noop } from "lodash";
|
||||
import React from "react";
|
||||
import { createRenderer } from "react-test-renderer/shallow";
|
||||
|
||||
import { removeFragmentRefs } from "coral-framework/testHelpers";
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
|
||||
import { removeFragmentRefs } from "coral-framework/testHelpers";
|
||||
import PermalinkView from "./PermalinkView";
|
||||
|
||||
const PermalinkViewN = removeFragmentRefs(PermalinkView);
|
||||
|
||||
@@ -4,6 +4,8 @@ import React, { FunctionComponent, MouseEvent } from "react";
|
||||
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import UserBoxContainer from "coral-stream/common/UserBox";
|
||||
import ReplyListContainer from "coral-stream/tabs/Comments/ReplyList";
|
||||
import {
|
||||
Button,
|
||||
CallOut,
|
||||
@@ -12,9 +14,6 @@ import {
|
||||
Typography,
|
||||
} from "coral-ui/components";
|
||||
|
||||
import UserBoxContainer from "coral-stream/common/UserBox";
|
||||
import ReplyListContainer from "coral-stream/tabs/Comments/ReplyList";
|
||||
|
||||
import ConversationThreadContainer from "./ConversationThreadContainer";
|
||||
|
||||
import styles from "./PermalinkView.css";
|
||||
@@ -48,7 +47,7 @@ const PermalinkView: FunctionComponent<PermalinkViewProps> = ({
|
||||
<HorizontalGutter
|
||||
className={cn(styles.root, CLASSES.permalinkView.$root, {
|
||||
[CLASSES.permalinkView.authenticated]: Boolean(viewer),
|
||||
[CLASSES.permalinkView.unauthenticated]: !Boolean(viewer),
|
||||
[CLASSES.permalinkView.unauthenticated]: !viewer,
|
||||
})}
|
||||
size="double"
|
||||
>
|
||||
|
||||
@@ -5,15 +5,16 @@ import { graphql } from "react-relay";
|
||||
import { getURLWithCommentID } from "coral-framework/helpers";
|
||||
import { withContext } from "coral-framework/lib/bootstrap";
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { PermalinkViewContainer_comment as CommentData } from "coral-stream/__generated__/PermalinkViewContainer_comment.graphql";
|
||||
import { PermalinkViewContainer_settings as SettingsData } from "coral-stream/__generated__/PermalinkViewContainer_settings.graphql";
|
||||
import { PermalinkViewContainer_story as StoryData } from "coral-stream/__generated__/PermalinkViewContainer_story.graphql";
|
||||
import { PermalinkViewContainer_viewer as ViewerData } from "coral-stream/__generated__/PermalinkViewContainer_viewer.graphql";
|
||||
import {
|
||||
SetCommentIDMutation,
|
||||
withSetCommentIDMutation,
|
||||
} from "coral-stream/mutations";
|
||||
|
||||
import { PermalinkViewContainer_comment as CommentData } from "coral-stream/__generated__/PermalinkViewContainer_comment.graphql";
|
||||
import { PermalinkViewContainer_settings as SettingsData } from "coral-stream/__generated__/PermalinkViewContainer_settings.graphql";
|
||||
import { PermalinkViewContainer_story as StoryData } from "coral-stream/__generated__/PermalinkViewContainer_story.graphql";
|
||||
import { PermalinkViewContainer_viewer as ViewerData } from "coral-stream/__generated__/PermalinkViewContainer_viewer.graphql";
|
||||
|
||||
import PermalinkView from "./PermalinkView";
|
||||
|
||||
interface PermalinkViewContainerProps {
|
||||
|
||||
@@ -7,11 +7,12 @@ import {
|
||||
QueryRenderer,
|
||||
withLocalStateContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { PermalinkViewQuery as QueryTypes } from "coral-stream/__generated__/PermalinkViewQuery.graphql";
|
||||
import { PermalinkViewQueryLocal as Local } from "coral-stream/__generated__/PermalinkViewQueryLocal.graphql";
|
||||
import Spinner from "coral-stream/common/Spinner";
|
||||
import { Delay } from "coral-ui/components";
|
||||
|
||||
import { PermalinkViewQuery as QueryTypes } from "coral-stream/__generated__/PermalinkViewQuery.graphql";
|
||||
import { PermalinkViewQueryLocal as Local } from "coral-stream/__generated__/PermalinkViewQueryLocal.graphql";
|
||||
|
||||
import PermalinkViewContainer from "./PermalinkViewContainer";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -14,14 +14,16 @@ import styles from "./RTE.css";
|
||||
// This is currently required in order for the RTE
|
||||
// to detect and setup the features.
|
||||
const Localized = React.forwardRef<any, PropTypesOf<typeof LocalizedOriginal>>(
|
||||
({ api, ...props }, ref) => (
|
||||
<LocalizedOriginal {...props}>
|
||||
{React.cloneElement(
|
||||
React.Children.only(props.children as React.ReactElement),
|
||||
{ api, ref }
|
||||
)}
|
||||
</LocalizedOriginal>
|
||||
)
|
||||
function RTELocalized({ api, ...props }, ref) {
|
||||
return (
|
||||
<LocalizedOriginal {...props}>
|
||||
{React.cloneElement(
|
||||
React.Children.only(props.children as React.ReactElement),
|
||||
{ api, ref }
|
||||
)}
|
||||
</LocalizedOriginal>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
export interface RTEProps {
|
||||
@@ -71,7 +73,6 @@ export interface RTEProps {
|
||||
forwardRef?: Ref<CoralRTE>;
|
||||
}
|
||||
|
||||
// tslint:disable:jsx-wrap-multiline
|
||||
const features = [
|
||||
<Localized key="bold" id="comments-rte-bold" attrs={{ title: true }}>
|
||||
<Bold>
|
||||
@@ -93,7 +94,6 @@ const features = [
|
||||
</Blockquote>
|
||||
</Localized>,
|
||||
];
|
||||
// tslint:enable:jsx-wrap-multiline
|
||||
|
||||
const RTE: FunctionComponent<RTEProps> = props => {
|
||||
const {
|
||||
|
||||
@@ -11,7 +11,7 @@ exports[`renders correctly 1`] = `
|
||||
contentContainerClassNameDisabled=""
|
||||
features={
|
||||
Array [
|
||||
<ForwardRef
|
||||
<ForwardRef(RTELocalized)
|
||||
attrs={
|
||||
Object {
|
||||
"title": true,
|
||||
@@ -26,8 +26,8 @@ exports[`renders correctly 1`] = `
|
||||
format_bold
|
||||
</ForwardRef(forwardRef)>
|
||||
</Toggle>
|
||||
</ForwardRef>,
|
||||
<ForwardRef
|
||||
</ForwardRef(RTELocalized)>,
|
||||
<ForwardRef(RTELocalized)
|
||||
attrs={
|
||||
Object {
|
||||
"title": true,
|
||||
@@ -42,8 +42,8 @@ exports[`renders correctly 1`] = `
|
||||
format_italic
|
||||
</ForwardRef(forwardRef)>
|
||||
</Toggle>
|
||||
</ForwardRef>,
|
||||
<ForwardRef
|
||||
</ForwardRef(RTELocalized)>,
|
||||
<ForwardRef(RTELocalized)
|
||||
attrs={
|
||||
Object {
|
||||
"title": true,
|
||||
@@ -58,7 +58,7 @@ exports[`renders correctly 1`] = `
|
||||
format_quote
|
||||
</ForwardRef(forwardRef)>
|
||||
</Toggle>
|
||||
</ForwardRef>,
|
||||
</ForwardRef(RTELocalized)>,
|
||||
]
|
||||
}
|
||||
placeholder="Post a comment"
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
fetchQuery,
|
||||
FetchVariables,
|
||||
} from "coral-framework/lib/relay";
|
||||
|
||||
import { RefreshSettingsFetchQuery as QueryTypes } from "coral-stream/__generated__/RefreshSettingsFetchQuery.graphql";
|
||||
|
||||
const RefreshSettingsFetch = createFetch(
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import cn from "classnames";
|
||||
import { Flex, Icon, Typography } from "coral-ui/components";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { FunctionComponent } from "react";
|
||||
|
||||
import { Flex, Icon, Typography } from "coral-ui/components";
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
remaining: number;
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
createSubscription,
|
||||
SubscriptionVariables,
|
||||
} from "coral-framework/lib/relay";
|
||||
|
||||
import { CommentReplyCreatedSubscription } from "coral-stream/__generated__/CommentReplyCreatedSubscription.graphql";
|
||||
|
||||
/**
|
||||
@@ -18,7 +19,7 @@ function determineDepthTillAncestor(comment: RecordProxy, ancestorID: string) {
|
||||
if (cur) {
|
||||
depth++;
|
||||
// Stop when reaching base ancestor.
|
||||
if (cur!.getValue("id") === ancestorID) {
|
||||
if (cur.getValue("id") === ancestorID) {
|
||||
return depth;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { graphql } from "react-relay";
|
||||
|
||||
import withFragmentContainer from "coral-framework/lib/relay/withFragmentContainer";
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
|
||||
import { LocalReplyListContainer_comment as CommentData } from "coral-stream/__generated__/LocalReplyListContainer_comment.graphql";
|
||||
import { LocalReplyListContainer_settings as SettingsData } from "coral-stream/__generated__/LocalReplyListContainer_settings.graphql";
|
||||
import { LocalReplyListContainer_story as StoryData } from "coral-stream/__generated__/LocalReplyListContainer_story.graphql";
|
||||
|
||||
@@ -75,9 +75,7 @@ const ReplyList: FunctionComponent<ReplyListProps> = props => {
|
||||
<Localized id="comments-replyList-showAll">
|
||||
<Button
|
||||
id={`coral-comments-replyList-showAll--${props.comment.id}`}
|
||||
aria-controls={`coral-comments-replyList-log--${
|
||||
props.comment.id
|
||||
}`}
|
||||
aria-controls={`coral-comments-replyList-log--${props.comment.id}`}
|
||||
className={CLASSES.replyList.showAllButton}
|
||||
onClick={props.onShowAll}
|
||||
disabled={props.disableShowAll}
|
||||
@@ -93,9 +91,7 @@ const ReplyList: FunctionComponent<ReplyListProps> = props => {
|
||||
<Indent level={props.indentLevel} noBorder>
|
||||
<Localized id="comments-replyList-showMoreReplies">
|
||||
<Button
|
||||
aria-controls={`coral-comments-replyList-log--${
|
||||
props.comment.id
|
||||
}`}
|
||||
aria-controls={`coral-comments-replyList-log--${props.comment.id}`}
|
||||
onClick={props.onViewNew}
|
||||
className={CLASSES.replyList.showMoreReplies}
|
||||
variant="outlined"
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from "coral-framework/lib/relay";
|
||||
import { FragmentKeys } from "coral-framework/lib/relay/types";
|
||||
import { Omit, PropTypesOf } from "coral-framework/types";
|
||||
|
||||
import { ReplyListContainer1_comment as CommentData } from "coral-stream/__generated__/ReplyListContainer1_comment.graphql";
|
||||
import { ReplyListContainer1_settings as SettingsData } from "coral-stream/__generated__/ReplyListContainer1_settings.graphql";
|
||||
import { ReplyListContainer1_story as StoryData } from "coral-stream/__generated__/ReplyListContainer1_story.graphql";
|
||||
@@ -98,7 +99,7 @@ export const ReplyListContainer: React.FunctionComponent<Props> = props => {
|
||||
0;
|
||||
|
||||
if (
|
||||
props.comment.replies == null ||
|
||||
props.comment.replies === null ||
|
||||
(props.comment.replies.edges.length === 0 && viewNewCount === 0)
|
||||
) {
|
||||
return null;
|
||||
|
||||
+4
-3
@@ -12,13 +12,14 @@ import {
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLCOMMENT_SORT } from "coral-framework/schema";
|
||||
import { Omit, PropTypesOf } from "coral-framework/types";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Box, Button, CallOut, HorizontalGutter } from "coral-ui/components";
|
||||
|
||||
import { AllCommentsTabContainer_settings } from "coral-stream/__generated__/AllCommentsTabContainer_settings.graphql";
|
||||
import { AllCommentsTabContainer_story } from "coral-stream/__generated__/AllCommentsTabContainer_story.graphql";
|
||||
import { AllCommentsTabContainer_viewer } from "coral-stream/__generated__/AllCommentsTabContainer_viewer.graphql";
|
||||
import { AllCommentsTabContainerLocal } from "coral-stream/__generated__/AllCommentsTabContainerLocal.graphql";
|
||||
import { AllCommentsTabContainerPaginationQueryVariables } from "coral-stream/__generated__/AllCommentsTabContainerPaginationQuery.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Box, Button, CallOut, HorizontalGutter } from "coral-ui/components";
|
||||
|
||||
import { CommentContainer } from "../../Comment";
|
||||
import IgnoredTombstoneOrHideContainer from "../../IgnoredTombstoneOrHideContainer";
|
||||
@@ -36,7 +37,7 @@ interface Props {
|
||||
relay: RelayPaginationProp;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
graphql`
|
||||
fragment AllCommentsTabContainer_comment on Comment {
|
||||
id
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import React, { FunctionComponent } from "react";
|
||||
import { ReadyState } from "react-relay";
|
||||
|
||||
import {
|
||||
graphql,
|
||||
QueryRenderer,
|
||||
withLocalStateContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { AllCommentsTabQuery as QueryTypes } from "coral-stream/__generated__/AllCommentsTabQuery.graphql";
|
||||
import { AllCommentsTabQueryLocal as Local } from "coral-stream/__generated__/AllCommentsTabQueryLocal.graphql";
|
||||
import Spinner from "coral-stream/common/Spinner";
|
||||
import { Flex } from "coral-ui/components";
|
||||
import React, { FunctionComponent } from "react";
|
||||
import { ReadyState } from "react-relay";
|
||||
|
||||
import { AllCommentsTabQuery as QueryTypes } from "coral-stream/__generated__/AllCommentsTabQuery.graphql";
|
||||
import { AllCommentsTabQueryLocal as Local } from "coral-stream/__generated__/AllCommentsTabQueryLocal.graphql";
|
||||
|
||||
import AllCommentsTabContainer from "./AllCommentsTabContainer";
|
||||
import SpinnerWhileRendering from "./SpinnerWhileRendering";
|
||||
|
||||
+2
-3
@@ -11,6 +11,7 @@ import {
|
||||
SubscriptionVariables,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLCOMMENT_SORT, GQLCOMMENT_SORT_RL } from "coral-framework/schema";
|
||||
|
||||
import { CommentCreatedSubscription } from "coral-stream/__generated__/CommentCreatedSubscription.graphql";
|
||||
|
||||
function updateForNewestFirst(
|
||||
@@ -80,9 +81,7 @@ const CommentCreatedSubscription = createSubscription(
|
||||
return;
|
||||
}
|
||||
throw new Error(
|
||||
`Unsupport new top level comment live updates for sort ${
|
||||
variables.orderBy
|
||||
}`
|
||||
`Unsupport new top level comment live updates for sort ${variables.orderBy}`
|
||||
);
|
||||
},
|
||||
})
|
||||
|
||||
+2
-3
@@ -11,6 +11,7 @@ import {
|
||||
SubscriptionVariables,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLCOMMENT_SORT, GQLCOMMENT_SORT_RL } from "coral-framework/schema";
|
||||
|
||||
import { CommentReleasedSubscription } from "coral-stream/__generated__/CommentReleasedSubscription.graphql";
|
||||
|
||||
function updateForNewestFirst(
|
||||
@@ -80,9 +81,7 @@ const CommentReleasedSubscription = createSubscription(
|
||||
return;
|
||||
}
|
||||
throw new Error(
|
||||
`Unsupport new top level comment live updates for sort ${
|
||||
variables.orderBy
|
||||
}`
|
||||
`Unsupport new top level comment live updates for sort ${variables.orderBy}`
|
||||
);
|
||||
},
|
||||
})
|
||||
|
||||
+4
-2
@@ -1,8 +1,10 @@
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { CommunityGuidelinesContainer_settings as SettingsData } from "coral-stream/__generated__/CommunityGuidelinesContainer_settings.graphql";
|
||||
import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import { CommunityGuidelinesContainer_settings as SettingsData } from "coral-stream/__generated__/CommunityGuidelinesContainer_settings.graphql";
|
||||
|
||||
import CommunityGuidelines from "./CommunityGuidelines";
|
||||
|
||||
interface Props {
|
||||
|
||||
+2
-3
@@ -5,6 +5,8 @@ import { graphql } from "react-relay";
|
||||
import { SCHEDULED_DELETION_TIMESPAN_DAYS } from "coral-common/constants";
|
||||
import { useCoralContext } from "coral-framework/lib/bootstrap";
|
||||
import { useMutation, withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import CancelAccountDeletionMutation from "coral-stream/mutations/CancelAccountDeletionMutation";
|
||||
import {
|
||||
Button,
|
||||
CallOut,
|
||||
@@ -14,9 +16,6 @@ import {
|
||||
Typography,
|
||||
} from "coral-ui/components";
|
||||
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import CancelAccountDeletionMutation from "coral-stream/mutations/CancelAccountDeletionMutation";
|
||||
|
||||
import { StreamDeletionRequestCalloutContainer_viewer } from "coral-stream/__generated__/StreamDeletionRequestCalloutContainer_viewer.graphql";
|
||||
|
||||
import styles from "./StreamDeletionRequestCalloutContainer.css";
|
||||
|
||||
+6
-5
@@ -6,10 +6,6 @@ import { graphql } from "react-relay";
|
||||
import { getURLWithCommentID } from "coral-framework/helpers";
|
||||
import withFragmentContainer from "coral-framework/lib/relay/withFragmentContainer";
|
||||
import { GQLUSER_STATUS } from "coral-framework/schema";
|
||||
import { FeaturedCommentContainer_comment as CommentData } from "coral-stream/__generated__/FeaturedCommentContainer_comment.graphql";
|
||||
import { FeaturedCommentContainer_settings as SettingsData } from "coral-stream/__generated__/FeaturedCommentContainer_settings.graphql";
|
||||
import { FeaturedCommentContainer_story as StoryData } from "coral-stream/__generated__/FeaturedCommentContainer_story.graphql";
|
||||
import { FeaturedCommentContainer_viewer as ViewerData } from "coral-stream/__generated__/FeaturedCommentContainer_viewer.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import HTMLContent from "coral-stream/common/HTMLContent";
|
||||
import {
|
||||
@@ -18,6 +14,11 @@ import {
|
||||
} from "coral-stream/mutations";
|
||||
import { Box, Flex, Icon, TextLink, Timestamp } from "coral-ui/components";
|
||||
|
||||
import { FeaturedCommentContainer_comment as CommentData } from "coral-stream/__generated__/FeaturedCommentContainer_comment.graphql";
|
||||
import { FeaturedCommentContainer_settings as SettingsData } from "coral-stream/__generated__/FeaturedCommentContainer_settings.graphql";
|
||||
import { FeaturedCommentContainer_story as StoryData } from "coral-stream/__generated__/FeaturedCommentContainer_story.graphql";
|
||||
import { FeaturedCommentContainer_viewer as ViewerData } from "coral-stream/__generated__/FeaturedCommentContainer_viewer.graphql";
|
||||
|
||||
import { UserTagsContainer } from "../../Comment";
|
||||
import ReactionButtonContainer from "../../Comment/ReactionButton";
|
||||
import { UsernameWithPopoverContainer } from "../../Comment/Username";
|
||||
@@ -121,7 +122,7 @@ const FeaturedCommentContainer: FunctionComponent<Props> = props => {
|
||||
<Localized id="comments-featured-gotoConversation">
|
||||
<span>Go to Conversation</span>
|
||||
</Localized>
|
||||
<span className={styles.gotoArrow}>></span>
|
||||
<span className={styles.gotoArrow}>></span>
|
||||
</TextLink>
|
||||
</div>
|
||||
</Flex>
|
||||
|
||||
+4
-3
@@ -1,3 +1,4 @@
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { FunctionComponent } from "react";
|
||||
import { graphql, RelayPaginationProp } from "react-relay";
|
||||
|
||||
@@ -6,13 +7,13 @@ import {
|
||||
withPaginationContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { Omit, PropTypesOf } from "coral-framework/types";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Button, HorizontalGutter } from "coral-ui/components";
|
||||
|
||||
import { FeaturedCommentsContainer_settings as SettingsData } from "coral-stream/__generated__/FeaturedCommentsContainer_settings.graphql";
|
||||
import { FeaturedCommentsContainer_story as StoryData } from "coral-stream/__generated__/FeaturedCommentsContainer_story.graphql";
|
||||
import { FeaturedCommentsContainer_viewer as ViewerData } from "coral-stream/__generated__/FeaturedCommentsContainer_viewer.graphql";
|
||||
import { FeaturedCommentsContainerPaginationQueryVariables } from "coral-stream/__generated__/FeaturedCommentsContainerPaginationQuery.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Button, HorizontalGutter } from "coral-ui/components";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
|
||||
import IgnoredTombstoneOrHideContainer from "../../IgnoredTombstoneOrHideContainer";
|
||||
import FeaturedCommentContainer from "./FeaturedCommentContainer";
|
||||
|
||||
+3
-2
@@ -6,11 +6,12 @@ import {
|
||||
QueryRenderer,
|
||||
withLocalStateContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { FeaturedCommentsQuery as QueryTypes } from "coral-stream/__generated__/FeaturedCommentsQuery.graphql";
|
||||
import { FeaturedCommentsQueryLocal as Local } from "coral-stream/__generated__/FeaturedCommentsQueryLocal.graphql";
|
||||
import Spinner from "coral-stream/common/Spinner";
|
||||
import { Delay, Flex } from "coral-ui/components";
|
||||
|
||||
import { FeaturedCommentsQuery as QueryTypes } from "coral-stream/__generated__/FeaturedCommentsQuery.graphql";
|
||||
import { FeaturedCommentsQueryLocal as Local } from "coral-stream/__generated__/FeaturedCommentsQueryLocal.graphql";
|
||||
|
||||
import FeaturedCommentsContainer from "./FeaturedCommentsContainer";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { MessageBoxContainer_story as StoryData } from "coral-stream/__generated__/MessageBoxContainer_story.graphql";
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import {
|
||||
MessageBox,
|
||||
MessageBoxContent,
|
||||
MessageBoxIcon,
|
||||
} from "coral-stream/common/MessageBox";
|
||||
|
||||
import { MessageBoxContainer_story as StoryData } from "coral-stream/__generated__/MessageBoxContainer_story.graphql";
|
||||
|
||||
interface Props {
|
||||
story: StoryData;
|
||||
className?: string;
|
||||
|
||||
+4
-4
@@ -6,8 +6,7 @@ import {
|
||||
RecordSourceSelectorProxy,
|
||||
} from "relay-runtime";
|
||||
|
||||
import { getViewer } from "coral-framework/helpers";
|
||||
import { roleIsAtLeast } from "coral-framework/helpers";
|
||||
import { getViewer, roleIsAtLeast } from "coral-framework/helpers";
|
||||
import { CoralContext } from "coral-framework/lib/bootstrap";
|
||||
import {
|
||||
commitMutationPromiseNormalized,
|
||||
@@ -17,6 +16,7 @@ import {
|
||||
MutationResponsePromise,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { GQLStory, GQLUSER_ROLE } from "coral-framework/schema";
|
||||
|
||||
import { CreateCommentMutation as MutationTypes } from "coral-stream/__generated__/CreateCommentMutation.graphql";
|
||||
|
||||
import {
|
||||
@@ -73,7 +73,7 @@ function addCommentToStory(
|
||||
}
|
||||
|
||||
/** These are needed to be included when querying for the stream. */
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
graphql`
|
||||
fragment CreateCommentMutation_viewer on User {
|
||||
role
|
||||
@@ -87,7 +87,7 @@ graphql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
graphql`
|
||||
fragment CreateCommentMutation_story on Story {
|
||||
settings {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import cn from "classnames";
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
import { FormApi, FormState } from "final-form";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { FunctionComponent } from "react";
|
||||
import { Field, Form, FormSpy } from "react-final-form";
|
||||
|
||||
import { OnSubmit } from "coral-framework/lib/form";
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import ValidationMessage from "coral-stream/common/ValidationMessage";
|
||||
import { AriaInfo, Button, Flex, HorizontalGutter } from "coral-ui/components";
|
||||
|
||||
+1
-2
@@ -3,8 +3,7 @@ import { noop } from "lodash";
|
||||
import React from "react";
|
||||
import sinon from "sinon";
|
||||
|
||||
import { timeout } from "coral-common/utils";
|
||||
import { pureMerge } from "coral-common/utils";
|
||||
import { pureMerge, timeout } from "coral-common/utils";
|
||||
import { createPromisifiedStorage } from "coral-framework/lib/storage";
|
||||
import { removeFragmentRefs } from "coral-framework/testHelpers";
|
||||
import { DeepPartial, PropTypesOf } from "coral-framework/types";
|
||||
|
||||
+8
-7
@@ -15,15 +15,16 @@ import {
|
||||
} from "coral-framework/lib/relay";
|
||||
import { PromisifiedStorage } from "coral-framework/lib/storage";
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
import { PostCommentFormContainer_settings } from "coral-stream/__generated__/PostCommentFormContainer_settings.graphql";
|
||||
import { PostCommentFormContainer_story } from "coral-stream/__generated__/PostCommentFormContainer_story.graphql";
|
||||
import { PostCommentFormContainer_viewer } from "coral-stream/__generated__/PostCommentFormContainer_viewer.graphql";
|
||||
import { COMMENTS_TAB } from "coral-stream/__generated__/StreamContainerLocal.graphql";
|
||||
import {
|
||||
ShowAuthPopupMutation,
|
||||
withShowAuthPopupMutation,
|
||||
} from "coral-stream/mutations";
|
||||
|
||||
import { PostCommentFormContainer_settings } from "coral-stream/__generated__/PostCommentFormContainer_settings.graphql";
|
||||
import { PostCommentFormContainer_story } from "coral-stream/__generated__/PostCommentFormContainer_story.graphql";
|
||||
import { PostCommentFormContainer_viewer } from "coral-stream/__generated__/PostCommentFormContainer_viewer.graphql";
|
||||
import { COMMENTS_TAB } from "coral-stream/__generated__/StreamContainerLocal.graphql";
|
||||
|
||||
import {
|
||||
getSubmitStatus,
|
||||
shouldTriggerSettingsRefresh,
|
||||
@@ -117,7 +118,7 @@ export class PostCommentFormContainer extends Component<Props, State> {
|
||||
>["onSubmit"] = async (input, form) => {
|
||||
try {
|
||||
if (this.props.tab === "FEATURED_COMMENTS") {
|
||||
await this.props.onChangeTab("ALL_COMMENTS");
|
||||
this.props.onChangeTab("ALL_COMMENTS");
|
||||
}
|
||||
|
||||
const submitStatus = getSubmitStatus(
|
||||
@@ -147,7 +148,7 @@ export class PostCommentFormContainer extends Component<Props, State> {
|
||||
this.disableNudge();
|
||||
return { [FORM_ERROR]: error.message };
|
||||
}
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
}
|
||||
return;
|
||||
@@ -213,7 +214,7 @@ export class PostCommentFormContainer extends Component<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
const scheduledForDeletion: boolean = Boolean(
|
||||
const scheduledForDeletion = Boolean(
|
||||
this.props.viewer.scheduledDeletionDate !== undefined &&
|
||||
this.props.viewer.scheduledDeletionDate !== null
|
||||
);
|
||||
|
||||
@@ -3,12 +3,12 @@ import { Localized } from "fluent-react/compat";
|
||||
import React, { FunctionComponent, useCallback } from "react";
|
||||
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import { Button, HorizontalGutter } from "coral-ui/components";
|
||||
|
||||
import RTE from "../../RTE";
|
||||
import MessageBoxContainer from "../MessageBoxContainer";
|
||||
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import styles from "./PostCommentFormFake.css";
|
||||
|
||||
interface Props {
|
||||
|
||||
+2
-1
@@ -18,7 +18,7 @@ export default class PostCommentSubmitStatusContainer extends React.Component<
|
||||
dismissed: false,
|
||||
};
|
||||
|
||||
public componentWillReceiveProps(nextProps: Props) {
|
||||
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
if (this.props.status !== nextProps.status) {
|
||||
this.setState({ dismissed: false });
|
||||
}
|
||||
@@ -34,6 +34,7 @@ export default class PostCommentSubmitStatusContainer extends React.Component<
|
||||
throw new Error("Not implemented");
|
||||
case "REJECTED":
|
||||
// TODO: Show a different message when rejected?
|
||||
// falls through
|
||||
case "IN_REVIEW":
|
||||
return this.state.dismissed ? null : (
|
||||
<PostCommentInReviewMessage onDismiss={this.handleOnDismiss} />
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { LocalizationProvider } from "fluent-react/compat";
|
||||
import { noop } from "lodash";
|
||||
import React from "react";
|
||||
import TestRenderer from "react-test-renderer";
|
||||
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
import { UIContext, UIContextProps } from "coral-ui/components";
|
||||
import { LocalizationProvider } from "fluent-react/compat";
|
||||
|
||||
import SortMenu from "./SortMenu";
|
||||
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ import React from "react";
|
||||
import { graphql, withFragmentContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import { StoryClosedTimeoutContainer_story as StoryData } from "coral-stream/__generated__/StoryClosedTimeoutContainer_story.graphql";
|
||||
|
||||
import {
|
||||
SetStoryClosedMutation,
|
||||
withSetStoryClosedMutation,
|
||||
@@ -31,7 +32,7 @@ class StoryClosedTimeoutContainer extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
public componentWillReceiveProps(nextProps: Props) {
|
||||
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
if (nextProps.story.closedAt !== this.props.story.closedAt) {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = createTimeout(this.handleClose, nextProps.story.closedAt);
|
||||
|
||||
@@ -5,13 +5,6 @@ import { graphql } from "react-relay";
|
||||
|
||||
import { useLocal, withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { GQLUSER_STATUS } from "coral-framework/schema";
|
||||
import { StreamContainer_settings as SettingsData } from "coral-stream/__generated__/StreamContainer_settings.graphql";
|
||||
import { StreamContainer_story as StoryData } from "coral-stream/__generated__/StreamContainer_story.graphql";
|
||||
import { StreamContainer_viewer as ViewerData } from "coral-stream/__generated__/StreamContainer_viewer.graphql";
|
||||
import {
|
||||
COMMENTS_TAB,
|
||||
StreamContainerLocal,
|
||||
} from "coral-stream/__generated__/StreamContainerLocal.graphql";
|
||||
import CLASSES from "coral-stream/classes";
|
||||
import Counter from "coral-stream/common/Counter";
|
||||
import { UserBoxContainer } from "coral-stream/common/UserBox";
|
||||
@@ -25,6 +18,14 @@ import {
|
||||
} from "coral-ui/components";
|
||||
import { PropTypesOf } from "coral-ui/types";
|
||||
|
||||
import { StreamContainer_settings as SettingsData } from "coral-stream/__generated__/StreamContainer_settings.graphql";
|
||||
import { StreamContainer_story as StoryData } from "coral-stream/__generated__/StreamContainer_story.graphql";
|
||||
import { StreamContainer_viewer as ViewerData } from "coral-stream/__generated__/StreamContainer_viewer.graphql";
|
||||
import {
|
||||
COMMENTS_TAB,
|
||||
StreamContainerLocal,
|
||||
} from "coral-stream/__generated__/StreamContainerLocal.graphql";
|
||||
|
||||
import AllCommentsTab from "./AllCommentsTab";
|
||||
import BannedInfo from "./BannedInfo";
|
||||
import { CommunityGuidelinesContainer } from "./CommunityGuidelines";
|
||||
@@ -34,10 +35,11 @@ import FeaturedCommentTooltip from "./FeaturedCommentTooltip";
|
||||
import { PostCommentFormContainer } from "./PostCommentForm";
|
||||
import SortMenu from "./SortMenu";
|
||||
import StoryClosedTimeoutContainer from "./StoryClosedTimeout";
|
||||
import styles from "./StreamContainer.css";
|
||||
import { SuspendedInfoContainer } from "./SuspendedInfo/index";
|
||||
import useCommentCountEvent from "./useCommentCountEvent";
|
||||
|
||||
import styles from "./StreamContainer.css";
|
||||
|
||||
interface Props {
|
||||
story: StoryData;
|
||||
settings: SettingsData;
|
||||
@@ -121,7 +123,7 @@ export const StreamContainer: FunctionComponent<Props> = props => {
|
||||
<HorizontalGutter
|
||||
className={cn(styles.root, {
|
||||
[CLASSES.commentsTabPane.authenticated]: Boolean(props.viewer),
|
||||
[CLASSES.commentsTabPane.unauthenticated]: !Boolean(props.viewer),
|
||||
[CLASSES.commentsTabPane.unauthenticated]: !props.viewer,
|
||||
})}
|
||||
size="double"
|
||||
>
|
||||
|
||||
@@ -7,11 +7,12 @@ import {
|
||||
QueryRenderer,
|
||||
withLocalStateContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import Spinner from "coral-stream/common/Spinner";
|
||||
import { Delay, Flex } from "coral-ui/components";
|
||||
|
||||
import { COMMENTS_TAB } from "coral-stream/__generated__/StreamContainerLocal.graphql";
|
||||
import { StreamQuery as QueryTypes } from "coral-stream/__generated__/StreamQuery.graphql";
|
||||
import { StreamQueryLocal as Local } from "coral-stream/__generated__/StreamQueryLocal.graphql";
|
||||
import Spinner from "coral-stream/common/Spinner";
|
||||
import { Delay, Flex } from "coral-ui/components";
|
||||
|
||||
import { AllCommentsTabQuery } from "./AllCommentsTab";
|
||||
import StreamContainer from "./StreamContainer";
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Localized } from "fluent-react/compat";
|
||||
import React, { FunctionComponent, useMemo } from "react";
|
||||
|
||||
import { useCoralContext } from "coral-framework/lib/bootstrap";
|
||||
|
||||
import { CallOut, HorizontalGutter, Typography } from "coral-ui/components";
|
||||
|
||||
interface Props {
|
||||
|
||||
+5
-3
@@ -1,9 +1,11 @@
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
import { SuspendedInfoContainer_settings as SettingsData } from "coral-stream/__generated__/SuspendedInfoContainer_settings.graphql";
|
||||
import { SuspendedInfoContainer_viewer as ViewerData } from "coral-stream/__generated__/SuspendedInfoContainer_viewer.graphql";
|
||||
import React, { FunctionComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import { SuspendedInfoContainer_settings as SettingsData } from "coral-stream/__generated__/SuspendedInfoContainer_settings.graphql";
|
||||
import { SuspendedInfoContainer_viewer as ViewerData } from "coral-stream/__generated__/SuspendedInfoContainer_viewer.graphql";
|
||||
|
||||
import SuspendedInfo from "./SuspendedInfo";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { getMessage } from "coral-framework/lib/i18n";
|
||||
/**
|
||||
* useCommentCountEvent is a React hook that will
|
||||
* emit `commentCount` events.
|
||||
*
|
||||
* @param storyID story id of the comment count
|
||||
* @param storyURL story url of the comment count
|
||||
* @param commentCount number of total published comments
|
||||
|
||||
@@ -4,6 +4,7 @@ import getHTMLText from "./getHTMLText";
|
||||
* cleanupRTEEmptyHTML will try to figure out if given html only contains
|
||||
* dead tags like `<b></b>` or `<br />` or `<i></i><br />` which basically
|
||||
* means renders nothing and return a standardized `""` instead.
|
||||
*
|
||||
* @param html the html to be cleaned up
|
||||
*/
|
||||
export default function cleanupRTEEmptyHTML(html: string) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import getHTMLCharacterLength from "./getHTMLCharacterLength";
|
||||
|
||||
/**
|
||||
* getBodyValidators will return validators based on given min & max parameters.
|
||||
*
|
||||
* @param min minimum length or null
|
||||
* @param max maximum length or null
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@ import getHTMLText from "./getHTMLText";
|
||||
/**
|
||||
* getHTMLCharacterLength will strip all tags and return remaining
|
||||
* character length.
|
||||
*
|
||||
* @param html the html which length should be determined
|
||||
*/
|
||||
export default function getHTMLCharacterLength(html: string | undefined) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/**
|
||||
* getHTMLText returns text representation of html.
|
||||
* Includes a different implementation during test that works.
|
||||
* @param html
|
||||
*
|
||||
* @param html string
|
||||
*/
|
||||
export default function getHTMLText(html: string) {
|
||||
if (process.env.NODE_ENV === "test") {
|
||||
// innerText is not implement in JSDOM, so we use `striptags` instead.
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const striptags = require("striptags");
|
||||
return striptags(html.replace(/<br *\/?>/, "\n"));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { MutationResponse } from "coral-framework/lib/relay";
|
||||
|
||||
import { CreateCommentMutation } from "coral-stream/__generated__/CreateCommentMutation.graphql";
|
||||
import { CreateCommentReplyMutation } from "coral-stream/__generated__/CreateCommentReplyMutation.graphql";
|
||||
import { EditCommentMutation } from "coral-stream/__generated__/EditCommentMutation.graphql";
|
||||
|
||||
@@ -12,6 +12,7 @@ const triggers = [
|
||||
* error codes signify that the settings on the client currently
|
||||
* mismatches with the newest settings on the server, and thus
|
||||
* e.g. validations fail.
|
||||
*
|
||||
* @param code the error code to check for
|
||||
*/
|
||||
export default function shouldTriggerSettingsRefresh(code: ERROR_CODES) {
|
||||
|
||||
@@ -2,6 +2,7 @@ import React from "react";
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import { ConfigureContainer_settings as SettingsData } from "coral-stream/__generated__/ConfigureContainer_settings.graphql";
|
||||
import { ConfigureContainer_story as StoryData } from "coral-stream/__generated__/ConfigureContainer_story.graphql";
|
||||
import { ConfigureContainer_viewer as ViewerData } from "coral-stream/__generated__/ConfigureContainer_viewer.graphql";
|
||||
|
||||
@@ -8,11 +8,12 @@ import {
|
||||
QueryRenderer,
|
||||
withLocalStateContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { ConfigureQuery as QueryTypes } from "coral-stream/__generated__/ConfigureQuery.graphql";
|
||||
import { ConfigureQueryLocal as Local } from "coral-stream/__generated__/ConfigureQueryLocal.graphql";
|
||||
import Spinner from "coral-stream/common/Spinner";
|
||||
import { Delay } from "coral-ui/components";
|
||||
|
||||
import { ConfigureQuery as QueryTypes } from "coral-stream/__generated__/ConfigureQuery.graphql";
|
||||
import { ConfigureQueryLocal as Local } from "coral-stream/__generated__/ConfigureQueryLocal.graphql";
|
||||
|
||||
const loadConfigureContainer = () =>
|
||||
import("./ConfigureContainer" /* webpackChunkName: "configure" */);
|
||||
// (cvle) For some reason without `setTimeout` this request will block other requests.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user