mirror of
https://github.com/wassname/talk.git
synced 2026-07-30 12:40:41 +08:00
chore: rename accept comment to approve comment (#2341)
This commit is contained in:
+9
-9
@@ -1,7 +1,7 @@
|
||||
import { graphql } from "react-relay";
|
||||
import { ConnectionHandler, Environment } from "relay-runtime";
|
||||
|
||||
import { AcceptCommentMutation as MutationTypes } from "coral-admin/__generated__/AcceptCommentMutation.graphql";
|
||||
import { ApproveCommentMutation as MutationTypes } from "coral-admin/__generated__/ApproveCommentMutation.graphql";
|
||||
import { getQueueConnection } from "coral-admin/helpers";
|
||||
import {
|
||||
commitMutationPromiseNormalized,
|
||||
@@ -11,19 +11,19 @@ import {
|
||||
|
||||
let clientMutationId = 0;
|
||||
|
||||
const AcceptCommentMutation = createMutation(
|
||||
"acceptComment",
|
||||
const ApproveCommentMutation = createMutation(
|
||||
"approveComment",
|
||||
(
|
||||
environment: Environment,
|
||||
input: MutationInput<MutationTypes> & { storyID?: string }
|
||||
) =>
|
||||
commitMutationPromiseNormalized<MutationTypes>(environment, {
|
||||
mutation: graphql`
|
||||
mutation AcceptCommentMutation(
|
||||
$input: AcceptCommentInput!
|
||||
mutation ApproveCommentMutation(
|
||||
$input: ApproveCommentInput!
|
||||
$storyID: ID
|
||||
) {
|
||||
acceptComment(input: $input) {
|
||||
approveComment(input: $input) {
|
||||
comment {
|
||||
id
|
||||
status
|
||||
@@ -51,10 +51,10 @@ const AcceptCommentMutation = createMutation(
|
||||
},
|
||||
},
|
||||
optimisticResponse: {
|
||||
acceptComment: {
|
||||
approveComment: {
|
||||
comment: {
|
||||
id: input.commentID,
|
||||
status: "ACCEPTED",
|
||||
status: "APPROVED",
|
||||
},
|
||||
clientMutationId: (clientMutationId++).toString(),
|
||||
},
|
||||
@@ -73,4 +73,4 @@ const AcceptCommentMutation = createMutation(
|
||||
})
|
||||
);
|
||||
|
||||
export default AcceptCommentMutation;
|
||||
export default ApproveCommentMutation;
|
||||
@@ -1,6 +1,6 @@
|
||||
export { default as SignInMutation } from "./SignInMutation";
|
||||
export { default as SetRedirectPathMutation } from "./SetRedirectPathMutation";
|
||||
export { default as AcceptCommentMutation } from "./AcceptCommentMutation";
|
||||
export { default as ApproveCommentMutation } from "./ApproveCommentMutation";
|
||||
export { default as RejectCommentMutation } from "./RejectCommentMutation";
|
||||
export { default as UpdateSettingsMutation } from "./UpdateSettingsMutation";
|
||||
export {
|
||||
|
||||
+5
-5
@@ -1,24 +1,24 @@
|
||||
import React from "react";
|
||||
import { createRenderer } from "react-test-renderer/shallow";
|
||||
|
||||
import AcceptButton from "./AcceptButton";
|
||||
import ApproveButton from "./ApproveButton";
|
||||
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
|
||||
it("renders correctly", () => {
|
||||
const props: PropTypesOf<typeof AcceptButton> = {
|
||||
const props: PropTypesOf<typeof ApproveButton> = {
|
||||
invert: false,
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
renderer.render(<AcceptButton {...props} />);
|
||||
renderer.render(<ApproveButton {...props} />);
|
||||
expect(renderer.getRenderOutput()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders correctly inverted", () => {
|
||||
const props: PropTypesOf<typeof AcceptButton> = {
|
||||
const props: PropTypesOf<typeof ApproveButton> = {
|
||||
invert: true,
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
renderer.render(<AcceptButton {...props} />);
|
||||
renderer.render(<ApproveButton {...props} />);
|
||||
expect(renderer.getRenderOutput()).toMatchSnapshot();
|
||||
});
|
||||
+5
-5
@@ -5,24 +5,24 @@ import React, { FunctionComponent } from "react";
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
import { BaseButton, Icon } from "coral-ui/components";
|
||||
|
||||
import styles from "./AcceptButton.css";
|
||||
import styles from "./ApproveButton.css";
|
||||
|
||||
interface Props extends PropTypesOf<typeof BaseButton> {
|
||||
invert?: boolean;
|
||||
}
|
||||
|
||||
const AcceptButton: FunctionComponent<Props> = ({
|
||||
const ApproveButton: FunctionComponent<Props> = ({
|
||||
invert,
|
||||
className,
|
||||
...rest
|
||||
}) => (
|
||||
<Localized id="moderate-comment-acceptButton" attrs={{ "aria-label": true }}>
|
||||
<Localized id="moderate-comment-approveButton" attrs={{ "aria-label": true }}>
|
||||
<BaseButton
|
||||
{...rest}
|
||||
className={cn(className, styles.root, {
|
||||
[styles.invert]: invert,
|
||||
})}
|
||||
aria-label="Accept"
|
||||
aria-label="Approve"
|
||||
>
|
||||
<Icon size="lg" className={styles.icon}>
|
||||
done
|
||||
@@ -31,4 +31,4 @@ const AcceptButton: FunctionComponent<Props> = ({
|
||||
</Localized>
|
||||
);
|
||||
|
||||
export default AcceptButton;
|
||||
export default ApproveButton;
|
||||
@@ -20,7 +20,7 @@ const baseProps: PropTypesOf<typeof ModerateCardN> = {
|
||||
viewContextHref: "http://localhost/comment",
|
||||
suspectWords: ["idiot"],
|
||||
bannedWords: ["fuck"],
|
||||
onAccept: noop,
|
||||
onApprove: noop,
|
||||
onReject: noop,
|
||||
showStory: false,
|
||||
};
|
||||
@@ -44,10 +44,10 @@ it("renders reply correctly", () => {
|
||||
expect(renderer.getRenderOutput()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders accepted correctly", () => {
|
||||
it("renders approved correctly", () => {
|
||||
const props: PropTypesOf<typeof ModerateCardN> = {
|
||||
...baseProps,
|
||||
status: "accepted",
|
||||
status: "approved",
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
renderer.render(<ModerateCardN {...props} />);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { PropTypesOf } from "coral-framework/types";
|
||||
import { Card, Flex, HorizontalGutter, TextLink } from "coral-ui/components";
|
||||
|
||||
import MarkersContainer from "../containers/MarkersContainer";
|
||||
import AcceptButton from "./AcceptButton";
|
||||
import ApproveButton from "./ApproveButton";
|
||||
import CommentContent from "./CommentContent";
|
||||
import InReplyTo from "./InReplyTo";
|
||||
import RejectButton from "./RejectButton";
|
||||
@@ -22,7 +22,7 @@ interface Props {
|
||||
body: string;
|
||||
inReplyTo: string | null;
|
||||
comment: PropTypesOf<typeof MarkersContainer>["comment"];
|
||||
status: "accepted" | "rejected" | "undecided";
|
||||
status: "approved" | "rejected" | "undecided";
|
||||
viewContextHref: string;
|
||||
suspectWords: ReadonlyArray<string>;
|
||||
bannedWords: ReadonlyArray<string>;
|
||||
@@ -30,7 +30,7 @@ interface Props {
|
||||
storyTitle?: React.ReactNode;
|
||||
storyHref?: string;
|
||||
onModerateStory?: React.EventHandler<React.MouseEvent>;
|
||||
onAccept: () => void;
|
||||
onApprove: () => void;
|
||||
onReject: () => void;
|
||||
/**
|
||||
* If set to true, it means this comment is about to be removed
|
||||
@@ -51,7 +51,7 @@ const ModerateCard: FunctionComponent<Props> = ({
|
||||
status,
|
||||
suspectWords,
|
||||
bannedWords,
|
||||
onAccept,
|
||||
onApprove,
|
||||
onReject,
|
||||
dangling,
|
||||
showStory,
|
||||
@@ -136,10 +136,10 @@ const ModerateCard: FunctionComponent<Props> = ({
|
||||
invert={status === "rejected"}
|
||||
disabled={status === "rejected" || dangling}
|
||||
/>
|
||||
<AcceptButton
|
||||
onClick={onAccept}
|
||||
invert={status === "accepted"}
|
||||
disabled={status === "accepted" || dangling}
|
||||
<ApproveButton
|
||||
onClick={onApprove}
|
||||
invert={status === "approved"}
|
||||
disabled={status === "approved" || dangling}
|
||||
/>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
+8
-8
@@ -7,14 +7,14 @@ exports[`renders correctly 1`] = `
|
||||
"aria-label": true,
|
||||
}
|
||||
}
|
||||
id="moderate-comment-acceptButton"
|
||||
id="moderate-comment-approveButton"
|
||||
>
|
||||
<ForwardRef(forwardRef)
|
||||
aria-label="Accept"
|
||||
className="AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="ApproveButton-root"
|
||||
>
|
||||
<ForwardRef(forwardRef)
|
||||
className="AcceptButton-icon"
|
||||
className="ApproveButton-icon"
|
||||
size="lg"
|
||||
>
|
||||
done
|
||||
@@ -30,14 +30,14 @@ exports[`renders correctly inverted 1`] = `
|
||||
"aria-label": true,
|
||||
}
|
||||
}
|
||||
id="moderate-comment-acceptButton"
|
||||
id="moderate-comment-approveButton"
|
||||
>
|
||||
<ForwardRef(forwardRef)
|
||||
aria-label="Accept"
|
||||
className="AcceptButton-root AcceptButton-invert"
|
||||
aria-label="Approve"
|
||||
className="ApproveButton-root ApproveButton-invert"
|
||||
>
|
||||
<ForwardRef(forwardRef)
|
||||
className="AcceptButton-icon"
|
||||
className="ApproveButton-icon"
|
||||
size="lg"
|
||||
>
|
||||
done
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders accepted correctly 1`] = `
|
||||
exports[`renders approved correctly 1`] = `
|
||||
<withPropsOnChange(Card)
|
||||
className="ModerateCard-root"
|
||||
data-testid="moderate-comment-comment-id"
|
||||
@@ -86,7 +86,7 @@ exports[`renders accepted correctly 1`] = `
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<AcceptButton
|
||||
<ApproveButton
|
||||
disabled={true}
|
||||
invert={true}
|
||||
onClick={[Function]}
|
||||
@@ -183,7 +183,7 @@ exports[`renders correctly 1`] = `
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<AcceptButton
|
||||
<ApproveButton
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
@@ -280,7 +280,7 @@ exports[`renders dangling correctly 1`] = `
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<AcceptButton
|
||||
<ApproveButton
|
||||
disabled={true}
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
@@ -378,7 +378,7 @@ exports[`renders rejected correctly 1`] = `
|
||||
invert={true}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<AcceptButton
|
||||
<ApproveButton
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
@@ -479,7 +479,7 @@ exports[`renders reply correctly 1`] = `
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<AcceptButton
|
||||
<ApproveButton
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
@@ -604,7 +604,7 @@ exports[`renders story info 1`] = `
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<AcceptButton
|
||||
<ApproveButton
|
||||
invert={false}
|
||||
onClick={[Function]}
|
||||
/>
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from "coral-admin/__generated__/ModerateCardContainer_comment.graphql";
|
||||
import { ModerateCardContainer_settings as SettingsData } from "coral-admin/__generated__/ModerateCardContainer_settings.graphql";
|
||||
import NotAvailable from "coral-admin/components/NotAvailable";
|
||||
import { AcceptCommentMutation } from "coral-admin/mutations";
|
||||
import { ApproveCommentMutation } from "coral-admin/mutations";
|
||||
import { RejectCommentMutation } from "coral-admin/mutations";
|
||||
import {
|
||||
MutationProp,
|
||||
@@ -22,7 +22,7 @@ import ModerateCard from "../components/ModerateCard";
|
||||
interface Props {
|
||||
comment: CommentData;
|
||||
settings: SettingsData;
|
||||
acceptComment: MutationProp<typeof AcceptCommentMutation>;
|
||||
approveComment: MutationProp<typeof ApproveCommentMutation>;
|
||||
rejectComment: MutationProp<typeof RejectCommentMutation>;
|
||||
danglingLogic: (status: COMMENT_STATUS) => boolean;
|
||||
match: Match;
|
||||
@@ -32,8 +32,8 @@ interface Props {
|
||||
|
||||
function getStatus(comment: CommentData) {
|
||||
switch (comment.status) {
|
||||
case "ACCEPTED":
|
||||
return "accepted";
|
||||
case "APPROVED":
|
||||
return "approved";
|
||||
case "REJECTED":
|
||||
return "rejected";
|
||||
default:
|
||||
@@ -42,8 +42,8 @@ function getStatus(comment: CommentData) {
|
||||
}
|
||||
|
||||
class ModerateCardContainer extends React.Component<Props> {
|
||||
private handleAccept = () => {
|
||||
this.props.acceptComment({
|
||||
private handleApprove = () => {
|
||||
this.props.approveComment({
|
||||
commentID: this.props.comment.id,
|
||||
commentRevisionID: this.props.comment.revision.id,
|
||||
storyID: this.props.match.params.storyID,
|
||||
@@ -81,7 +81,7 @@ class ModerateCardContainer extends React.Component<Props> {
|
||||
viewContextHref={comment.permalink}
|
||||
suspectWords={settings.wordList.suspect}
|
||||
bannedWords={settings.wordList.banned}
|
||||
onAccept={this.handleAccept}
|
||||
onApprove={this.handleApprove}
|
||||
onReject={this.handleReject}
|
||||
dangling={danglingLogic(comment.status)}
|
||||
showStory={showStoryInfo}
|
||||
@@ -135,7 +135,7 @@ const enhanced = withFragmentContainer<Props>({
|
||||
`,
|
||||
})(
|
||||
withRouter(
|
||||
withMutation(AcceptCommentMutation)(
|
||||
withMutation(ApproveCommentMutation)(
|
||||
withMutation(RejectCommentMutation)(ModerateCardContainer)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ interface QueueContainerProps {
|
||||
|
||||
// TODO: use generated types
|
||||
const danglingLogic = (status: string) =>
|
||||
["ACCEPTED", "REJECTED"].indexOf(status) >= 0;
|
||||
["APPROVED", "REJECTED"].indexOf(status) >= 0;
|
||||
|
||||
export class QueueContainer extends React.Component<QueueContainerProps> {
|
||||
public static routeConfig: RouteProps;
|
||||
|
||||
@@ -19,7 +19,7 @@ interface RejectedQueueContainerProps {
|
||||
}
|
||||
|
||||
// TODO: use generated types
|
||||
const danglingLogic = (status: string) => ["ACCEPTED"].indexOf(status) >= 0;
|
||||
const danglingLogic = (status: string) => ["APPROVED"].indexOf(status) >= 0;
|
||||
|
||||
export class RejectedQueueContainer extends React.Component<
|
||||
RejectedQueueContainerProps
|
||||
|
||||
+6
-6
@@ -39,7 +39,7 @@ exports[`loads more 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-sm AcceptedIcon-root"
|
||||
className="Icon-root Icon-sm ApprovedIcon-root"
|
||||
>
|
||||
check
|
||||
</span>
|
||||
@@ -48,7 +48,7 @@ exports[`loads more 1`] = `
|
||||
<p
|
||||
className="Typography-root Typography-bodyCopy Typography-colorTextPrimary Info-root"
|
||||
>
|
||||
Accepted comment by
|
||||
Approved comment by
|
||||
<strong>
|
||||
dany
|
||||
</strong>
|
||||
@@ -167,7 +167,7 @@ exports[`loads more 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-sm AcceptedIcon-root"
|
||||
className="Icon-root Icon-sm ApprovedIcon-root"
|
||||
>
|
||||
check
|
||||
</span>
|
||||
@@ -176,7 +176,7 @@ exports[`loads more 1`] = `
|
||||
<p
|
||||
className="Typography-root Typography-bodyCopy Typography-colorTextPrimary Info-root"
|
||||
>
|
||||
Accepted comment by
|
||||
Approved comment by
|
||||
<strong>
|
||||
dany
|
||||
</strong>
|
||||
@@ -296,7 +296,7 @@ exports[`render popover content 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-sm AcceptedIcon-root"
|
||||
className="Icon-root Icon-sm ApprovedIcon-root"
|
||||
>
|
||||
check
|
||||
</span>
|
||||
@@ -305,7 +305,7 @@ exports[`render popover content 1`] = `
|
||||
<p
|
||||
className="Typography-root Typography-bodyCopy Typography-colorTextPrimary Info-root"
|
||||
>
|
||||
Accepted comment by
|
||||
Approved comment by
|
||||
<strong>
|
||||
addy
|
||||
</strong>
|
||||
|
||||
@@ -196,7 +196,7 @@ export const moderationActions = createFixtures<GQLCommentModerationAction>([
|
||||
},
|
||||
},
|
||||
createdAt: "2018-11-29T16:01:51.897Z",
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
__typename: "CommentModerationAction",
|
||||
},
|
||||
{
|
||||
@@ -228,7 +228,7 @@ export const moderationActions = createFixtures<GQLCommentModerationAction>([
|
||||
},
|
||||
},
|
||||
createdAt: "2018-11-29T16:01:42.060Z",
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
__typename: "CommentModerationAction",
|
||||
},
|
||||
{
|
||||
@@ -260,7 +260,7 @@ export const moderationActions = createFixtures<GQLCommentModerationAction>([
|
||||
},
|
||||
},
|
||||
createdAt: "2018-11-29T16:01:30.648Z",
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
__typename: "CommentModerationAction",
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`rejected queue accepts comment in rejected queue: count should be 1 1`] = `
|
||||
exports[`rejected queue approves comment in rejected queue: count should be 1 1`] = `
|
||||
<span
|
||||
className="Counter-root Counter-colorInherit"
|
||||
data-testid="moderate-navigation-reported-count"
|
||||
@@ -13,7 +13,7 @@ exports[`rejected queue accepts comment in rejected queue: count should be 1 1`]
|
||||
</span>
|
||||
`;
|
||||
|
||||
exports[`rejected queue accepts comment in rejected queue: dangling 1`] = `
|
||||
exports[`rejected queue approves comment in rejected queue: dangling 1`] = `
|
||||
<div
|
||||
className="Card-root ModerateCard-root ModerateCard-dangling"
|
||||
data-testid="moderate-comment-comment-0"
|
||||
@@ -178,8 +178,8 @@ exports[`rejected queue accepts comment in rejected queue: dangling 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root AcceptButton-invert"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root ApproveButton-invert"
|
||||
disabled={true}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -191,7 +191,7 @@ exports[`rejected queue accepts comment in rejected queue: dangling 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -377,8 +377,8 @@ exports[`rejected queue renders rejected queue with comments 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -390,7 +390,7 @@ exports[`rejected queue renders rejected queue with comments 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -563,8 +563,8 @@ exports[`rejected queue renders rejected queue with comments 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -576,7 +576,7 @@ exports[`rejected queue renders rejected queue with comments 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -768,8 +768,8 @@ exports[`rejected queue renders rejected queue with comments and load more 1`] =
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -781,7 +781,7 @@ exports[`rejected queue renders rejected queue with comments and load more 1`] =
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -792,7 +792,7 @@ exports[`rejected queue renders rejected queue with comments and load more 1`] =
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`reported queue accepts comment in reported queue: count should be 1 1`] = `
|
||||
exports[`reported queue approves comment in reported queue: count should be 1 1`] = `
|
||||
<span
|
||||
className="Counter-root Counter-colorInherit"
|
||||
data-testid="moderate-navigation-reported-count"
|
||||
@@ -805,7 +805,7 @@ exports[`reported queue accepts comment in reported queue: count should be 1 1`]
|
||||
</span>
|
||||
`;
|
||||
|
||||
exports[`reported queue accepts comment in reported queue: dangling 1`] = `
|
||||
exports[`reported queue approves comment in reported queue: dangling 1`] = `
|
||||
<div
|
||||
className="Card-root ModerateCard-root ModerateCard-dangling"
|
||||
data-testid="moderate-comment-comment-0"
|
||||
@@ -970,8 +970,8 @@ exports[`reported queue accepts comment in reported queue: dangling 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root AcceptButton-invert"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root ApproveButton-invert"
|
||||
disabled={true}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -983,7 +983,7 @@ exports[`reported queue accepts comment in reported queue: dangling 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -1172,8 +1172,8 @@ exports[`reported queue rejects comment in reported queue: dangling 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={true}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -1185,7 +1185,7 @@ exports[`reported queue rejects comment in reported queue: dangling 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -1392,8 +1392,8 @@ exports[`reported queue renders reported queue with comments 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -1405,7 +1405,7 @@ exports[`reported queue renders reported queue with comments 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -1578,8 +1578,8 @@ exports[`reported queue renders reported queue with comments 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -1591,7 +1591,7 @@ exports[`reported queue renders reported queue with comments 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -1780,8 +1780,8 @@ exports[`reported queue renders reported queue with comments 2`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -1793,7 +1793,7 @@ exports[`reported queue renders reported queue with comments 2`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -1966,8 +1966,8 @@ exports[`reported queue renders reported queue with comments 2`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -1979,7 +1979,7 @@ exports[`reported queue renders reported queue with comments 2`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -2176,8 +2176,8 @@ exports[`reported queue renders reported queue with comments and load more 1`] =
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -2189,7 +2189,7 @@ exports[`reported queue renders reported queue with comments and load more 1`] =
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -2454,7 +2454,7 @@ exports[`search bar all stories renders search bar 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`single comment view accepts single comment 1`] = `
|
||||
exports[`single comment view approves single comment 1`] = `
|
||||
<div
|
||||
className="Card-root ModerateCard-root"
|
||||
data-testid="moderate-comment-comment-0"
|
||||
@@ -2598,8 +2598,8 @@ exports[`single comment view accepts single comment 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root AcceptButton-invert"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root ApproveButton-invert"
|
||||
disabled={true}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -2611,7 +2611,7 @@ exports[`single comment view accepts single comment 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -2766,8 +2766,8 @@ exports[`single comment view rejects single comment 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -2779,7 +2779,7 @@ exports[`single comment view rejects single comment 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
@@ -2969,8 +2969,8 @@ exports[`single comment view renders single comment view 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Accept"
|
||||
className="BaseButton-root AcceptButton-root"
|
||||
aria-label="Approve"
|
||||
className="BaseButton-root ApproveButton-root"
|
||||
disabled={false}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
@@ -2982,7 +2982,7 @@ exports[`single comment view renders single comment view 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="Icon-root Icon-lg AcceptButton-icon"
|
||||
className="Icon-root Icon-lg ApproveButton-icon"
|
||||
>
|
||||
done
|
||||
</span>
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
GQLCOMMENT_STATUS,
|
||||
GQLResolver,
|
||||
ModerationQueueToCommentsResolver,
|
||||
MutationToAcceptCommentResolver,
|
||||
MutationToApproveCommentResolver,
|
||||
MutationToRejectCommentResolver,
|
||||
QueryToCommentResolver,
|
||||
} from "coral-framework/schema";
|
||||
@@ -590,9 +590,9 @@ describe("reported queue", () => {
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("accepts comment in reported queue", async () => {
|
||||
const acceptCommentStub = createMutationResolverStub<
|
||||
MutationToAcceptCommentResolver
|
||||
it("approves comment in reported queue", async () => {
|
||||
const approveCommentStub = createMutationResolverStub<
|
||||
MutationToApproveCommentResolver
|
||||
>(({ variables }) => {
|
||||
expectAndFail(variables).toMatchObject({
|
||||
commentID: reportedComments[0].id,
|
||||
@@ -601,7 +601,7 @@ describe("reported queue", () => {
|
||||
return {
|
||||
comment: {
|
||||
id: reportedComments[0].id,
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
},
|
||||
moderationQueues: pureMerge(emptyModerationQueues, {
|
||||
reported: {
|
||||
@@ -644,7 +644,7 @@ describe("reported queue", () => {
|
||||
moderationQueues: () => moderationQueuesStub,
|
||||
},
|
||||
Mutation: {
|
||||
acceptComment: acceptCommentStub,
|
||||
approveComment: approveCommentStub,
|
||||
},
|
||||
}),
|
||||
});
|
||||
@@ -653,10 +653,10 @@ describe("reported queue", () => {
|
||||
const { getByTestID } = within(testRenderer.root);
|
||||
const comment = await waitForElement(() => getByTestID(testID));
|
||||
|
||||
const AcceptButton = await waitForElement(() =>
|
||||
within(comment).getByLabelText("Accept")
|
||||
const ApproveButton = await waitForElement(() =>
|
||||
within(comment).getByLabelText("Approve")
|
||||
);
|
||||
AcceptButton.props.onClick();
|
||||
ApproveButton.props.onClick();
|
||||
|
||||
// Snapshot dangling state of comment.
|
||||
expect(toJSON(comment)).toMatchSnapshot("dangling");
|
||||
@@ -664,7 +664,7 @@ describe("reported queue", () => {
|
||||
// Wait until comment is gone.
|
||||
await waitUntilThrow(() => getByTestID(testID));
|
||||
|
||||
expect(acceptCommentStub.called).toBe(true);
|
||||
expect(approveCommentStub.called).toBe(true);
|
||||
|
||||
// Count should have been updated.
|
||||
expect(
|
||||
@@ -923,9 +923,9 @@ describe("rejected queue", () => {
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("accepts comment in rejected queue", async () => {
|
||||
const acceptCommentStub = createMutationResolverStub<
|
||||
MutationToAcceptCommentResolver
|
||||
it("approves comment in rejected queue", async () => {
|
||||
const approveCommentStub = createMutationResolverStub<
|
||||
MutationToApproveCommentResolver
|
||||
>(({ variables }) => {
|
||||
expectAndFail(variables).toMatchObject({
|
||||
commentID: rejectedComments[0].id,
|
||||
@@ -934,7 +934,7 @@ describe("rejected queue", () => {
|
||||
return {
|
||||
comment: {
|
||||
id: rejectedComments[0].id,
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
},
|
||||
moderationQueues: pureMerge(emptyModerationQueues, {
|
||||
reported: {
|
||||
@@ -972,7 +972,7 @@ describe("rejected queue", () => {
|
||||
},
|
||||
},
|
||||
Mutation: {
|
||||
acceptComment: acceptCommentStub,
|
||||
approveComment: approveCommentStub,
|
||||
},
|
||||
}),
|
||||
});
|
||||
@@ -981,10 +981,10 @@ describe("rejected queue", () => {
|
||||
const { getByTestID } = within(testRenderer.root);
|
||||
const comment = await waitForElement(() => getByTestID(testID));
|
||||
|
||||
const AcceptButton = await waitForElement(() =>
|
||||
within(comment).getByLabelText("Accept")
|
||||
const ApproveButton = await waitForElement(() =>
|
||||
within(comment).getByLabelText("Approve")
|
||||
);
|
||||
AcceptButton.props.onClick();
|
||||
ApproveButton.props.onClick();
|
||||
|
||||
// Snapshot dangling state of comment.
|
||||
expect(toJSON(getByTestID(testID))).toMatchSnapshot("dangling");
|
||||
@@ -992,7 +992,7 @@ describe("rejected queue", () => {
|
||||
// Wait until comment is gone.
|
||||
await waitUntilThrow(() => getByTestID(testID));
|
||||
|
||||
expect(acceptCommentStub.called).toBe(true);
|
||||
expect(approveCommentStub.called).toBe(true);
|
||||
|
||||
// Count should have been updated.
|
||||
expect(
|
||||
@@ -1031,9 +1031,9 @@ describe("single comment view", () => {
|
||||
expect(toJSON(container)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("accepts single comment", async () => {
|
||||
const acceptCommentStub = createMutationResolverStub<
|
||||
MutationToAcceptCommentResolver
|
||||
it("approves single comment", async () => {
|
||||
const approveCommentStub = createMutationResolverStub<
|
||||
MutationToApproveCommentResolver
|
||||
>(({ variables }) => {
|
||||
expectAndFail(variables).toMatchObject({
|
||||
commentID: comment.id,
|
||||
@@ -1042,7 +1042,7 @@ describe("single comment view", () => {
|
||||
return {
|
||||
comment: {
|
||||
id: comment.id,
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
},
|
||||
moderationQueues: emptyModerationQueues,
|
||||
};
|
||||
@@ -1054,20 +1054,20 @@ describe("single comment view", () => {
|
||||
comment: commentStub,
|
||||
},
|
||||
Mutation: {
|
||||
acceptComment: acceptCommentStub,
|
||||
approveComment: approveCommentStub,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const { getByLabelText, getByTestID } = within(testRenderer.root);
|
||||
const AcceptButton = await waitForElement(() => getByLabelText("Accept"));
|
||||
AcceptButton.props.onClick();
|
||||
const ApproveButton = await waitForElement(() => getByLabelText("Approve"));
|
||||
ApproveButton.props.onClick();
|
||||
|
||||
expect(
|
||||
toJSON(getByTestID(`moderate-comment-${comment.id}`))
|
||||
).toMatchSnapshot();
|
||||
|
||||
expect(acceptCommentStub.called).toBe(true);
|
||||
expect(approveCommentStub.called).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects single comment", async () => {
|
||||
|
||||
+3
-3
@@ -4,16 +4,16 @@ import { createRenderer } from "react-test-renderer/shallow";
|
||||
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
|
||||
import AcceptedComment from "./AcceptedComment";
|
||||
import ApprovedComment from "./ApprovedComment";
|
||||
|
||||
it("renders correctly", () => {
|
||||
const props: PropTypesOf<typeof AcceptedComment> = {
|
||||
const props: PropTypesOf<typeof ApprovedComment> = {
|
||||
href: "#",
|
||||
username: "InTheExpensiveSeats",
|
||||
date: "2018-07-06T18:24:00.000Z",
|
||||
onGotoComment: noop,
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
renderer.render(<AcceptedComment {...props} />);
|
||||
renderer.render(<ApprovedComment {...props} />);
|
||||
expect(renderer.getRenderOutput()).toMatchSnapshot();
|
||||
});
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { FunctionComponent } from "react";
|
||||
|
||||
import AcceptedIcon from "./AcceptedIcon";
|
||||
import ApprovedIcon from "./ApprovedIcon";
|
||||
import DecisionItem from "./DecisionItem";
|
||||
import DotDivider from "./DotDivider";
|
||||
import Footer from "./Footer";
|
||||
@@ -22,13 +22,13 @@ const Username: FunctionComponent<{ username: string }> = ({ username }) => (
|
||||
<strong>{username}</strong>
|
||||
);
|
||||
|
||||
const AcceptedComment: FunctionComponent<Props> = props => (
|
||||
<DecisionItem icon={<AcceptedIcon />}>
|
||||
const ApprovedComment: FunctionComponent<Props> = props => (
|
||||
<DecisionItem icon={<ApprovedIcon />}>
|
||||
<Localized
|
||||
id="decisionHistory-acceptedCommentBy"
|
||||
id="decisionHistory-approvedCommentBy"
|
||||
Username={<Username username={props.username} />}
|
||||
>
|
||||
<Info>{"Accepted comment by <Username></Username>"}</Info>
|
||||
<Info>{"Approved comment by <Username></Username>"}</Info>
|
||||
</Localized>
|
||||
<Footer>
|
||||
<Typography variant="timestamp">
|
||||
@@ -40,4 +40,4 @@ const AcceptedComment: FunctionComponent<Props> = props => (
|
||||
</DecisionItem>
|
||||
);
|
||||
|
||||
export default AcceptedComment;
|
||||
export default ApprovedComment;
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import React from "react";
|
||||
import { createRenderer } from "react-test-renderer/shallow";
|
||||
|
||||
import AcceptedIcon from "./AcceptedIcon";
|
||||
import ApprovedIcon from "./ApprovedIcon";
|
||||
|
||||
it("renders correctly", () => {
|
||||
const renderer = createRenderer();
|
||||
renderer.render(<AcceptedIcon />);
|
||||
renderer.render(<ApprovedIcon />);
|
||||
expect(renderer.getRenderOutput()).toMatchSnapshot();
|
||||
});
|
||||
+3
-3
@@ -2,10 +2,10 @@ import React, { FunctionComponent } from "react";
|
||||
|
||||
import { Icon } from "coral-ui/components";
|
||||
|
||||
import styles from "./AcceptedIcon.css";
|
||||
import styles from "./ApprovedIcon.css";
|
||||
|
||||
const AcceptedIcon: FunctionComponent = () => (
|
||||
const ApprovedIcon: FunctionComponent = () => (
|
||||
<Icon className={styles.root}>check</Icon>
|
||||
);
|
||||
|
||||
export default AcceptedIcon;
|
||||
export default ApprovedIcon;
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
exports[`renders correctly 1`] = `
|
||||
<DecisionItem
|
||||
icon={<AcceptedIcon />}
|
||||
icon={<ApprovedIcon />}
|
||||
>
|
||||
<Localized
|
||||
Username={
|
||||
@@ -10,10 +10,10 @@ exports[`renders correctly 1`] = `
|
||||
username="InTheExpensiveSeats"
|
||||
/>
|
||||
}
|
||||
id="decisionHistory-acceptedCommentBy"
|
||||
id="decisionHistory-approvedCommentBy"
|
||||
>
|
||||
<Info>
|
||||
Accepted comment by <Username></Username>
|
||||
Approved comment by <Username></Username>
|
||||
</Info>
|
||||
</Localized>
|
||||
<Footer>
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
exports[`renders correctly 1`] = `
|
||||
<ForwardRef(forwardRef)
|
||||
className="AcceptedIcon-root"
|
||||
className="ApprovedIcon-root"
|
||||
>
|
||||
check
|
||||
</ForwardRef(forwardRef)>
|
||||
+3
-3
@@ -4,7 +4,7 @@ import { graphql } from "react-relay";
|
||||
import { DecisionHistoryItemContainer_action as ActionData } from "coral-admin/__generated__/DecisionHistoryItemContainer_action.graphql";
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import AcceptedComment from "../components/AcceptedComment";
|
||||
import ApprovedComment from "../components/ApprovedComment";
|
||||
import RejectedComment from "../components/RejectedComment";
|
||||
|
||||
interface DecisionHistoryItemContainerProps {
|
||||
@@ -23,9 +23,9 @@ class DecisionHistoryItemContainer extends React.Component<
|
||||
(this.props.action.revision.comment.author &&
|
||||
this.props.action.revision.comment.author.username) ||
|
||||
"Unknown"; // TODO: (cvle) Figure out what to display, when username is not available.
|
||||
if (this.props.action.status === "ACCEPTED") {
|
||||
if (this.props.action.status === "APPROVED") {
|
||||
return (
|
||||
<AcceptedComment
|
||||
<ApprovedComment
|
||||
href={href}
|
||||
username={username}
|
||||
date={this.props.action.createdAt}
|
||||
|
||||
Reference in New Issue
Block a user