mirror of
https://github.com/wassname/talk.git
synced 2026-07-06 05:17:19 +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}
|
||||
|
||||
@@ -7,7 +7,7 @@ const buildOptions = (inputOptions: RequestInit = {}) => {
|
||||
const defaultOptions: RequestInit = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
Approve: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
credentials: "same-origin",
|
||||
|
||||
@@ -16,7 +16,7 @@ enum PROFILE_TAB {
|
||||
|
||||
enum COMMENT_VIEWER_ACTION {
|
||||
EDIT
|
||||
ACCEPT
|
||||
APPROVE
|
||||
REJECT
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -6,17 +6,17 @@ import {
|
||||
createMutation,
|
||||
MutationInput,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { AcceptCommentMutation as MutationTypes } from "coral-stream/__generated__/AcceptCommentMutation.graphql";
|
||||
import { ApproveCommentMutation as MutationTypes } from "coral-stream/__generated__/ApproveCommentMutation.graphql";
|
||||
|
||||
let clientMutationId = 0;
|
||||
|
||||
const AcceptCommentMutation = createMutation(
|
||||
"acceptComment",
|
||||
const ApproveCommentMutation = createMutation(
|
||||
"approveComment",
|
||||
(environment: Environment, input: MutationInput<MutationTypes>) =>
|
||||
commitMutationPromiseNormalized<MutationTypes>(environment, {
|
||||
mutation: graphql`
|
||||
mutation AcceptCommentMutation($input: AcceptCommentInput!) {
|
||||
acceptComment(input: $input) {
|
||||
mutation ApproveCommentMutation($input: ApproveCommentInput!) {
|
||||
approveComment(input: $input) {
|
||||
comment {
|
||||
status
|
||||
}
|
||||
@@ -25,9 +25,9 @@ const AcceptCommentMutation = createMutation(
|
||||
}
|
||||
`,
|
||||
optimisticResponse: {
|
||||
acceptComment: {
|
||||
approveComment: {
|
||||
comment: {
|
||||
status: "ACCEPTED",
|
||||
status: "APPROVED",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -38,9 +38,9 @@ const AcceptCommentMutation = createMutation(
|
||||
},
|
||||
},
|
||||
updater: store => {
|
||||
store.get(input.commentID)!.setValue("ACCEPT", "lastViewerAction");
|
||||
store.get(input.commentID)!.setValue("APPROVE", "lastViewerAction");
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
export default AcceptCommentMutation;
|
||||
export default ApproveCommentMutation;
|
||||
+9
-9
@@ -11,7 +11,7 @@ import {
|
||||
Icon,
|
||||
} from "coral-ui/components";
|
||||
|
||||
import AcceptCommentMutation from "./AcceptCommentMutation";
|
||||
import ApproveCommentMutation from "./ApproveCommentMutation";
|
||||
import styles from "./ModerationDropdownContainer.css";
|
||||
import RejectCommentMutation from "./RejectCommentMutation";
|
||||
|
||||
@@ -24,24 +24,24 @@ const ModerationDropdownContainer: FunctionComponent<Props> = ({
|
||||
comment,
|
||||
onDismiss,
|
||||
}) => {
|
||||
const accept = useMutation(AcceptCommentMutation);
|
||||
const approve = useMutation(ApproveCommentMutation);
|
||||
const reject = useMutation(RejectCommentMutation);
|
||||
|
||||
const onAccept = useCallback(() => {
|
||||
accept({ commentID: comment.id, commentRevisionID: comment.revision.id });
|
||||
}, [accept, comment]);
|
||||
const onApprove = useCallback(() => {
|
||||
approve({ commentID: comment.id, commentRevisionID: comment.revision.id });
|
||||
}, [approve, comment]);
|
||||
const onReject = useCallback(
|
||||
() =>
|
||||
reject({ commentID: comment.id, commentRevisionID: comment.revision.id }),
|
||||
[accept, comment]
|
||||
[approve, comment]
|
||||
);
|
||||
|
||||
const accepted = comment.status === "ACCEPTED";
|
||||
const approved = comment.status === "APPROVED";
|
||||
const rejected = comment.status === "REJECTED";
|
||||
|
||||
return (
|
||||
<Dropdown>
|
||||
{accepted ? (
|
||||
{approved ? (
|
||||
<Localized id="comments-moderationDropdown-approved">
|
||||
<DropdownButton
|
||||
icon={<Icon className={styles.approved}>check</Icon>}
|
||||
@@ -53,7 +53,7 @@ const ModerationDropdownContainer: FunctionComponent<Props> = ({
|
||||
</Localized>
|
||||
) : (
|
||||
<Localized id="comments-moderationDropdown-approve">
|
||||
<DropdownButton icon={<Icon>check</Icon>} onClick={onAccept}>
|
||||
<DropdownButton icon={<Icon>check</Icon>} onClick={onApprove}>
|
||||
Approve
|
||||
</DropdownButton>
|
||||
</Localized>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { COMMENT_STATUS } from "coral-stream/__generated__/CreateCommentMutation.graphql";
|
||||
|
||||
const VisibleStatus = ["ACCEPTED", "NONE"];
|
||||
const VisibleStatus = ["APPROVED", "NONE"];
|
||||
|
||||
export default function isCommentVisible(comment: {
|
||||
status: COMMENT_STATUS;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// TODO: use generated schema types.
|
||||
const visibleStatuses = ["NONE", "ACCEPTED"];
|
||||
const visibleStatuses = ["NONE", "APPROVED"];
|
||||
|
||||
export default function isVisible(status: any) {
|
||||
return visibleStatuses.includes(status);
|
||||
|
||||
@@ -63,18 +63,18 @@ it("render go to moderate link", async () => {
|
||||
expect(link.props.href).toBe(`/admin/moderate/comment/${firstComment.id}`);
|
||||
});
|
||||
|
||||
it("accept comment", async () => {
|
||||
it("approve comment", async () => {
|
||||
const { testRenderer } = await createTestRenderer({
|
||||
resolvers: createResolversStub<GQLResolver>({
|
||||
Mutation: {
|
||||
acceptComment: ({ variables }) => {
|
||||
approveComment: ({ variables }) => {
|
||||
expectAndFail(variables).toMatchObject({
|
||||
commentID: firstComment.id,
|
||||
commentRevisionID: firstComment.revision.id,
|
||||
});
|
||||
return {
|
||||
comment: pureMerge<typeof firstComment>(firstComment, {
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
}),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import TenantContext from "coral-server/graph/tenant/context";
|
||||
import { accept, reject } from "coral-server/services/comments/moderation";
|
||||
import { approve, reject } from "coral-server/services/comments/moderation";
|
||||
import {
|
||||
GQLAcceptCommentInput,
|
||||
GQLApproveCommentInput,
|
||||
GQLRejectCommentInput,
|
||||
} from "../schema/__generated__/types";
|
||||
|
||||
export const Actions = (ctx: TenantContext) => ({
|
||||
acceptComment: (input: GQLAcceptCommentInput) =>
|
||||
accept(ctx.mongo, ctx.redis, ctx.tenant, {
|
||||
approveComment: (input: GQLApproveCommentInput) =>
|
||||
approve(ctx.mongo, ctx.redis, ctx.tenant, {
|
||||
commentID: input.commentID,
|
||||
commentRevisionID: input.commentRevisionID,
|
||||
moderatorID: ctx.user!.id,
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { GQLAcceptCommentPayloadTypeResolver } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
import { moderationQueuesResolver } from "./ModerationQueues";
|
||||
|
||||
export const AcceptCommentPayload: GQLAcceptCommentPayloadTypeResolver = {
|
||||
moderationQueues: moderationQueuesResolver,
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { GQLApproveCommentPayloadTypeResolver } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
import { moderationQueuesResolver } from "./ModerationQueues";
|
||||
|
||||
export const ApproveCommentPayload: GQLApproveCommentPayloadTypeResolver = {
|
||||
moderationQueues: moderationQueuesResolver,
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
AcceptCommentPayloadToModerationQueuesResolver,
|
||||
ApproveCommentPayloadToModerationQueuesResolver,
|
||||
GQLModerationQueuesTypeResolver,
|
||||
QueryToModerationQueuesResolver,
|
||||
RejectCommentPayloadToModerationQueuesResolver,
|
||||
@@ -89,7 +89,7 @@ export const sharedModerationInputResolver = async (
|
||||
*/
|
||||
export const moderationQueuesResolver:
|
||||
| QueryToModerationQueuesResolver
|
||||
| AcceptCommentPayloadToModerationQueuesResolver
|
||||
| ApproveCommentPayloadToModerationQueuesResolver
|
||||
| RejectCommentPayloadToModerationQueuesResolver = async (
|
||||
source,
|
||||
args,
|
||||
|
||||
@@ -83,8 +83,8 @@ export const Mutation: Required<GQLMutationTypeResolver<void>> = {
|
||||
story: await ctx.mutators.Stories.scrape(input),
|
||||
clientMutationId: input.clientMutationId,
|
||||
}),
|
||||
acceptComment: async (source, { input }, ctx) => ({
|
||||
comment: await ctx.mutators.Actions.acceptComment(input),
|
||||
approveComment: async (source, { input }, ctx) => ({
|
||||
comment: await ctx.mutators.Actions.approveComment(input),
|
||||
clientMutationId: input.clientMutationId,
|
||||
}),
|
||||
rejectComment: async (source, { input }, ctx) => ({
|
||||
|
||||
@@ -2,7 +2,7 @@ import Cursor from "coral-server/graph/common/scalars/cursor";
|
||||
import Time from "coral-server/graph/common/scalars/time";
|
||||
import { GQLResolver } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
import { AcceptCommentPayload } from "./AcceptCommentPayload";
|
||||
import { ApproveCommentPayload } from "./ApproveCommentPayload";
|
||||
import { AuthIntegrations } from "./AuthIntegrations";
|
||||
import { BanStatus } from "./BanStatus";
|
||||
import { BanStatusHistory } from "./BanStatusHistory";
|
||||
@@ -31,7 +31,7 @@ import { User } from "./User";
|
||||
import { UserStatus } from "./UserStatus";
|
||||
|
||||
const Resolvers: GQLResolver = {
|
||||
AcceptCommentPayload,
|
||||
ApproveCommentPayload,
|
||||
AuthIntegrations,
|
||||
BanStatus,
|
||||
BanStatusHistory,
|
||||
|
||||
@@ -1560,9 +1560,9 @@ enum COMMENT_STATUS {
|
||||
NONE
|
||||
|
||||
"""
|
||||
The comment has been accepted by a moderator.
|
||||
The comment has been approved by a moderator.
|
||||
"""
|
||||
ACCEPTED
|
||||
APPROVED
|
||||
|
||||
"""
|
||||
The comment has been rejected by a moderator.
|
||||
@@ -1894,9 +1894,9 @@ type CommentStatusCounts {
|
||||
NONE: Int!
|
||||
|
||||
"""
|
||||
The comment has been accepted by a moderator.
|
||||
The comment has been approved by a moderator.
|
||||
"""
|
||||
ACCEPTED: Int!
|
||||
APPROVED: Int!
|
||||
|
||||
"""
|
||||
The comment has been rejected by a moderator.
|
||||
@@ -3516,17 +3516,17 @@ type ScrapeStoryPayload {
|
||||
}
|
||||
|
||||
##################
|
||||
# acceptComment
|
||||
# approveComment
|
||||
##################
|
||||
|
||||
input AcceptCommentInput {
|
||||
input ApproveCommentInput {
|
||||
"""
|
||||
commentID is the ID of the Comment that was accepted.
|
||||
commentID is the ID of the Comment that was approved.
|
||||
"""
|
||||
commentID: ID!
|
||||
|
||||
"""
|
||||
commentRevisionID is the ID of the CommentRevision that is being accepted.
|
||||
commentRevisionID is the ID of the CommentRevision that is being approved.
|
||||
"""
|
||||
commentRevisionID: ID!
|
||||
|
||||
@@ -3536,9 +3536,9 @@ input AcceptCommentInput {
|
||||
clientMutationId: String!
|
||||
}
|
||||
|
||||
type AcceptCommentPayload {
|
||||
type ApproveCommentPayload {
|
||||
"""
|
||||
comment is the Comment that was accepted.
|
||||
comment is the Comment that was approved.
|
||||
"""
|
||||
comment: Comment
|
||||
|
||||
@@ -4213,9 +4213,9 @@ type Mutation {
|
||||
@auth(roles: [ADMIN, MODERATOR])
|
||||
|
||||
"""
|
||||
acceptComment will mark the Comment as ACCEPTED.
|
||||
approveComment will mark the Comment as APPROVED.
|
||||
"""
|
||||
acceptComment(input: AcceptCommentInput!): AcceptCommentPayload!
|
||||
approveComment(input: ApproveCommentInput!): ApproveCommentPayload!
|
||||
@auth(roles: [MODERATOR, ADMIN])
|
||||
|
||||
"""
|
||||
|
||||
@@ -6,5 +6,5 @@ import { GQLCOMMENT_STATUS } from "coral-server/graph/tenant/schema/__generated_
|
||||
*/
|
||||
export const VISIBLE_STATUSES = [
|
||||
GQLCOMMENT_STATUS.NONE,
|
||||
GQLCOMMENT_STATUS.ACCEPTED,
|
||||
GQLCOMMENT_STATUS.APPROVED,
|
||||
];
|
||||
|
||||
@@ -305,7 +305,7 @@ export type EditCommentInput = Pick<
|
||||
const EDITABLE_STATUSES = [
|
||||
GQLCOMMENT_STATUS.NONE,
|
||||
GQLCOMMENT_STATUS.PREMOD,
|
||||
GQLCOMMENT_STATUS.ACCEPTED,
|
||||
GQLCOMMENT_STATUS.APPROVED,
|
||||
];
|
||||
|
||||
export function validateEditable(
|
||||
|
||||
@@ -23,7 +23,7 @@ export function createEmptyCommentModerationQueueCounts(): CommentModerationQueu
|
||||
|
||||
export function createEmptyCommentStatusCounts(): CommentStatusCounts {
|
||||
return {
|
||||
[GQLCOMMENT_STATUS.ACCEPTED]: 0,
|
||||
[GQLCOMMENT_STATUS.APPROVED]: 0,
|
||||
[GQLCOMMENT_STATUS.NONE]: 0,
|
||||
[GQLCOMMENT_STATUS.PREMOD]: 0,
|
||||
[GQLCOMMENT_STATUS.REJECTED]: 0,
|
||||
|
||||
@@ -38,7 +38,7 @@ export async function createStoryCountIndexes(mongo: Db) {
|
||||
* statuses.
|
||||
*/
|
||||
export interface CommentStatusCounts {
|
||||
[GQLCOMMENT_STATUS.ACCEPTED]: number;
|
||||
[GQLCOMMENT_STATUS.APPROVED]: number;
|
||||
[GQLCOMMENT_STATUS.NONE]: number;
|
||||
[GQLCOMMENT_STATUS.PREMOD]: number;
|
||||
[GQLCOMMENT_STATUS.REJECTED]: number;
|
||||
@@ -208,7 +208,7 @@ export function mergeCommentStatusCount(
|
||||
// Because the CommentStatusCounts are not indexable, it should be accessed
|
||||
// by walking the structure.
|
||||
switch (status) {
|
||||
case GQLCOMMENT_STATUS.ACCEPTED:
|
||||
case GQLCOMMENT_STATUS.APPROVED:
|
||||
case GQLCOMMENT_STATUS.NONE:
|
||||
case GQLCOMMENT_STATUS.PREMOD:
|
||||
case GQLCOMMENT_STATUS.REJECTED:
|
||||
@@ -239,7 +239,7 @@ export function calculateTotalCommentCount(
|
||||
// Because the CommentStatusCounts are not indexable, it should be accessed
|
||||
// by walking the structure.
|
||||
switch (status) {
|
||||
case GQLCOMMENT_STATUS.ACCEPTED:
|
||||
case GQLCOMMENT_STATUS.APPROVED:
|
||||
case GQLCOMMENT_STATUS.NONE:
|
||||
case GQLCOMMENT_STATUS.PREMOD:
|
||||
case GQLCOMMENT_STATUS.REJECTED:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { GQLCOMMENT_STATUS } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
import { calculateCountsDiff } from "./counts";
|
||||
|
||||
it("allows transition from NONE to ACCEPTED", () => {
|
||||
it("allows transition from NONE to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.NONE, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
total: -1,
|
||||
@@ -49,11 +49,11 @@ it("allows transition from NONE to FLAGGED*", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from FLAGGED* to ACCEPTED", () => {
|
||||
it("allows transition from FLAGGED* to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.NONE, actionCounts: { FLAG: 1 } },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: { FLAG: 1 } }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: { FLAG: 1 } }
|
||||
)
|
||||
).toEqual({
|
||||
total: -1,
|
||||
@@ -81,11 +81,11 @@ it("allows transition from FLAGGED* to REJECTED", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from PREMOD to ACCEPTED", () => {
|
||||
it("allows transition from PREMOD to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.PREMOD, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
total: -1,
|
||||
@@ -113,11 +113,11 @@ it("allows transition from PREMOD to REJECTED", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from SYSTEM_WITHHELD to ACCEPTED", () => {
|
||||
it("allows transition from SYSTEM_WITHHELD to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.SYSTEM_WITHHELD, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
total: -1,
|
||||
@@ -145,10 +145,10 @@ it("allows transition from SYSTEM_WITHHELD to REJECTED", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from ACCEPTED to REJECTED", () => {
|
||||
it("allows transition from APPROVED to REJECTED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.REJECTED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
@@ -161,11 +161,11 @@ it("allows transition from ACCEPTED to REJECTED", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from REJECTED to ACCEPTED", () => {
|
||||
it("allows transition from REJECTED to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.REJECTED, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
total: 0,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { GQLCOMMENT_STATUS } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
import { calculateCountsDiff } from "./counts";
|
||||
|
||||
it("allows transition from NONE to ACCEPTED", () => {
|
||||
it("allows transition from NONE to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.NONE, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
total: -1,
|
||||
@@ -49,11 +49,11 @@ it("allows transition from NONE to FLAGGED*", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from FLAGGED* to ACCEPTED", () => {
|
||||
it("allows transition from FLAGGED* to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.NONE, actionCounts: { FLAG: 1 } },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: { FLAG: 1 } }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: { FLAG: 1 } }
|
||||
)
|
||||
).toEqual({
|
||||
total: -1,
|
||||
@@ -81,11 +81,11 @@ it("allows transition from FLAGGED* to REJECTED", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from PREMOD to ACCEPTED", () => {
|
||||
it("allows transition from PREMOD to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.PREMOD, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
total: -1,
|
||||
@@ -113,11 +113,11 @@ it("allows transition from PREMOD to REJECTED", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from SYSTEM_WITHHELD to ACCEPTED", () => {
|
||||
it("allows transition from SYSTEM_WITHHELD to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.SYSTEM_WITHHELD, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
total: -1,
|
||||
@@ -145,10 +145,10 @@ it("allows transition from SYSTEM_WITHHELD to REJECTED", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from ACCEPTED to REJECTED", () => {
|
||||
it("allows transition from APPROVED to REJECTED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.REJECTED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
@@ -161,11 +161,11 @@ it("allows transition from ACCEPTED to REJECTED", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("allows transition from REJECTED to ACCEPTED", () => {
|
||||
it("allows transition from REJECTED to APPROVED", () => {
|
||||
expect(
|
||||
calculateCountsDiff(
|
||||
{ status: GQLCOMMENT_STATUS.REJECTED, actionCounts: {} },
|
||||
{ status: GQLCOMMENT_STATUS.ACCEPTED, actionCounts: {} }
|
||||
{ status: GQLCOMMENT_STATUS.APPROVED, actionCounts: {} }
|
||||
)
|
||||
).toEqual({
|
||||
total: 0,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { calculateCountsDiff } from "./counts";
|
||||
export type Moderate = Omit<CreateCommentModerationActionInput, "status">;
|
||||
|
||||
const moderate = (
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED | GQLCOMMENT_STATUS.REJECTED
|
||||
status: GQLCOMMENT_STATUS.APPROVED | GQLCOMMENT_STATUS.REJECTED
|
||||
) => async (
|
||||
mongo: Db,
|
||||
redis: AugmentedRedis,
|
||||
@@ -98,6 +98,6 @@ const moderate = (
|
||||
return result.comment;
|
||||
};
|
||||
|
||||
export const accept = moderate(GQLCOMMENT_STATUS.ACCEPTED);
|
||||
export const approve = moderate(GQLCOMMENT_STATUS.APPROVED);
|
||||
|
||||
export const reject = moderate(GQLCOMMENT_STATUS.REJECTED);
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("compose", () => {
|
||||
});
|
||||
|
||||
it("handles when it returns a status", async () => {
|
||||
const status = GQLCOMMENT_STATUS.ACCEPTED;
|
||||
const status = GQLCOMMENT_STATUS.APPROVED;
|
||||
const enhanced = compose([() => ({ status })]);
|
||||
|
||||
await expect(enhanced(context)).resolves.toEqual({
|
||||
@@ -38,7 +38,7 @@ describe("compose", () => {
|
||||
});
|
||||
|
||||
it("merges the metadata", async () => {
|
||||
const status = GQLCOMMENT_STATUS.ACCEPTED;
|
||||
const status = GQLCOMMENT_STATUS.APPROVED;
|
||||
const enhanced = compose([
|
||||
() => ({ metadata: { first: true } }),
|
||||
() => ({ status, metadata: { second: true } }),
|
||||
@@ -55,7 +55,7 @@ describe("compose", () => {
|
||||
});
|
||||
|
||||
it("merges actions", async () => {
|
||||
const status = GQLCOMMENT_STATUS.ACCEPTED;
|
||||
const status = GQLCOMMENT_STATUS.APPROVED;
|
||||
|
||||
const flags = [
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ export const staff: IntermediateModerationPhase = ({
|
||||
}): IntermediatePhaseResult | void => {
|
||||
if (author.role !== GQLUSER_ROLE.COMMENTER) {
|
||||
return {
|
||||
status: GQLCOMMENT_STATUS.ACCEPTED,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
tags: [
|
||||
{
|
||||
type: COMMENT_TAG_TYPE.STAFF,
|
||||
|
||||
@@ -298,7 +298,7 @@ decisionHistory-showMoreButton =
|
||||
Show More
|
||||
decisionHistory-yourDecisionHistory = Your Decision History
|
||||
decisionHistory-rejectedCommentBy = Rejected comment by <Username></Username>
|
||||
decisionHistory-acceptedCommentBy = Accepted comment by <Username></Username>
|
||||
decisionHistory-approvedCommentBy = Approved comment by <Username></Username>
|
||||
decisionHistory-goToComment = Go to comment
|
||||
|
||||
## moderate
|
||||
@@ -330,8 +330,8 @@ moderate-comment-inReplyTo = Reply to <Username></Username>
|
||||
moderate-comment-viewContext = View Context
|
||||
moderate-comment-rejectButton =
|
||||
.aria-label = Reject
|
||||
moderate-comment-acceptButton =
|
||||
.aria-label = Accept
|
||||
moderate-comment-approveButton =
|
||||
.aria-label = Approve
|
||||
moderate-comment-decision = Decision
|
||||
moderate-comment-story = Story
|
||||
moderate-comment-moderateStory = Moderate Story
|
||||
|
||||
Reference in New Issue
Block a user