[CORL-218] In Stream Approve and Reject (#2340)

* feat: instream moderation

* fix: tests

* test: add tests for in stream moderation

* fix: lint

* fix: snapshots
This commit is contained in:
Kiwi
2019-06-04 19:27:15 +02:00
committed by GitHub
parent 1cf2f61bfb
commit 593d94ddbb
74 changed files with 1106 additions and 297 deletions
@@ -51,7 +51,7 @@ const FacebookConfig: FunctionComponent<Props> = ({
<HorizontalGutter size="double">
<Localized
id="configure-auth-facebook-toEnableIntegration"
link={<FacebookLink />}
Link={<FacebookLink />}
>
<Typography>
To enable the integration with Facebook Authentication, you need to
@@ -49,7 +49,7 @@ const GoogleConfig: FunctionComponent<Props> = ({ disabled, callbackURL }) => (
<HorizontalGutter size="double">
<Localized
id="configure-auth-google-toEnableIntegration"
link={<GoogleLink />}
Link={<GoogleLink />}
>
<Typography>
To enable the integration with Google Authentication you need to
@@ -70,7 +70,7 @@ const OIDCConfig: FunctionComponent<Props> = ({
>
{disabledInside => (
<HorizontalGutter size="double">
<Localized id="configure-auth-oidc-toLearnMore" link={<OIDCLink />}>
<Localized id="configure-auth-oidc-toLearnMore" Link={<OIDCLink />}>
<Typography>
{"To learn more: https://openid.net/connect/"}
</Typography>
@@ -19,13 +19,13 @@ const InReplyTo: FunctionComponent<Props> = ({ children }) => {
return (
<Flex alignItems="center">
<Icon className={styles.icon}>reply</Icon>{" "}
<Localized id="moderate-comment-inReplyTo" username={<Username />}>
<Localized id="moderate-comment-inReplyTo" Username={<Username />}>
<Typography
variant="timestamp"
container="span"
className={styles.inReplyTo}
>
{"Reply to <username><username>"}
{"Reply to <Username></Username>"}
</Typography>
</Localized>
</Flex>
@@ -91,7 +91,6 @@ const ModerateCard: FunctionComponent<Props> = ({
className={styles.link}
href={viewContextHref}
target="_blank"
external
>
View Context
</TextLink>
@@ -108,7 +107,6 @@ const ModerateCard: FunctionComponent<Props> = ({
<TextLink
className={styles.link}
href={storyHref}
target="_blank"
onClick={onModerateStory}
>
Moderate Story
@@ -11,15 +11,15 @@ exports[`renders correctly 1`] = `
</ForwardRef(forwardRef)>
<Localized
Username={<Username />}
id="moderate-comment-inReplyTo"
username={<Username />}
>
<ForwardRef(forwardRef)
className="InReplyTo-inReplyTo"
container="span"
variant="timestamp"
>
Reply to &lt;username&gt;&lt;username&gt;
Reply to &lt;Username&gt;&lt;/Username&gt;
</ForwardRef(forwardRef)>
</Localized>
</ForwardRef(forwardRef)>
@@ -48,7 +48,6 @@ exports[`renders accepted correctly 1`] = `
>
<withPropsOnChange(TextLinkProps)
className="ModerateCard-link"
external={true}
href="http://localhost/comment"
target="_blank"
>
@@ -146,7 +145,6 @@ exports[`renders correctly 1`] = `
>
<withPropsOnChange(TextLinkProps)
className="ModerateCard-link"
external={true}
href="http://localhost/comment"
target="_blank"
>
@@ -243,7 +241,6 @@ exports[`renders dangling correctly 1`] = `
>
<withPropsOnChange(TextLinkProps)
className="ModerateCard-link"
external={true}
href="http://localhost/comment"
target="_blank"
>
@@ -342,7 +339,6 @@ exports[`renders rejected correctly 1`] = `
>
<withPropsOnChange(TextLinkProps)
className="ModerateCard-link"
external={true}
href="http://localhost/comment"
target="_blank"
>
@@ -445,7 +441,6 @@ exports[`renders reply correctly 1`] = `
>
<withPropsOnChange(TextLinkProps)
className="ModerateCard-link"
external={true}
href="http://localhost/comment"
target="_blank"
>
@@ -542,7 +537,6 @@ exports[`renders story info 1`] = `
>
<withPropsOnChange(TextLinkProps)
className="ModerateCard-link"
external={true}
href="http://localhost/comment"
target="_blank"
>
@@ -574,7 +568,6 @@ exports[`renders story info 1`] = `
className="ModerateCard-link"
href="/story"
onClick={[Function]}
target="_blank"
>
Moderate Story
</withPropsOnChange(TextLinkProps)>
@@ -72,7 +72,7 @@ it("logs out", async () => {
userMenu.props.onClick();
const signOutButton = await waitForElement(() =>
within(testRenderer.root).getByText("Sign Out")
within(testRenderer.root).getByText("Sign Out", { selector: "button" })
);
signOutButton.props.onClick();
@@ -161,7 +161,7 @@ it("change user role", async () => {
TestRenderer.act(() => {
within(popup)
.getByText("Staff")
.getByText("Staff", { selector: "button" })
.props.onClick();
});
@@ -360,7 +360,7 @@ it("ban user", async () => {
TestRenderer.act(() => {
within(popup)
.getByText("Ban User")
.getByText("Ban User", { selector: "button" })
.props.onClick();
});
@@ -434,7 +434,7 @@ it("remove user ban", async () => {
TestRenderer.act(() => {
within(popup)
.getByText("Remove Ban")
.getByText("Remove Ban", { selector: "button" })
.props.onClick();
});
@@ -61,6 +61,12 @@ exports[`change settings: during submit: oidc without errors 1`] = `
target="_blank"
>
https://openid.net/connect/
<span
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
open_in_new
</span>
</a>
</p>
<hr
@@ -497,6 +503,12 @@ For more information visit:
target="_blank"
>
https://developers.facebook.com/docs/facebook-login/web
<span
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
open_in_new
</span>
</a>
.
</p>
@@ -772,6 +784,12 @@ exports[`change settings: enable oidc configure box 1`] = `
target="_blank"
>
https://openid.net/connect/
<span
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
open_in_new
</span>
</a>
</p>
<hr
@@ -1206,6 +1224,12 @@ exports[`change settings: oidc validation errors 1`] = `
target="_blank"
>
https://openid.net/connect/
<span
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
open_in_new
</span>
</a>
</p>
<hr
@@ -2082,6 +2106,12 @@ integration to register for a new account.
target="_blank"
>
https://openid.net/connect/
<span
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
open_in_new
</span>
</a>
</p>
<hr
@@ -2736,6 +2766,12 @@ to create and set up a web application. For more information visit:
target="_blank"
>
https://developers.google.com/identity/protocols/OAuth2WebServer#creatingcred
<span
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
open_in_new
</span>
</a>
.
</p>
@@ -3010,6 +3046,12 @@ For more information visit:
target="_blank"
>
https://developers.facebook.com/docs/facebook-login/web
<span
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
open_in_new
</span>
</a>
.
</p>
@@ -67,7 +67,7 @@ exports[`rejected queue accepts comment in rejected queue: dangling 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -88,7 +88,6 @@ exports[`rejected queue accepts comment in rejected queue: dangling 1`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -267,7 +266,7 @@ exports[`rejected queue renders rejected queue with comments 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -288,7 +287,6 @@ exports[`rejected queue renders rejected queue with comments 1`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -454,7 +452,7 @@ exports[`rejected queue renders rejected queue with comments 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -475,7 +473,6 @@ exports[`rejected queue renders rejected queue with comments 1`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -647,7 +644,7 @@ exports[`rejected queue renders rejected queue with comments and load more 1`] =
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -668,7 +665,6 @@ exports[`rejected queue renders rejected queue with comments and load more 1`] =
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -863,7 +859,7 @@ exports[`reported queue accepts comment in reported queue: dangling 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -884,7 +880,6 @@ exports[`reported queue accepts comment in reported queue: dangling 1`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -1066,7 +1061,7 @@ exports[`reported queue rejects comment in reported queue: dangling 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -1087,7 +1082,6 @@ exports[`reported queue rejects comment in reported queue: dangling 1`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -1287,7 +1281,7 @@ exports[`reported queue renders reported queue with comments 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -1308,7 +1302,6 @@ exports[`reported queue renders reported queue with comments 1`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -1474,7 +1467,7 @@ exports[`reported queue renders reported queue with comments 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -1495,7 +1488,6 @@ exports[`reported queue renders reported queue with comments 1`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -1677,7 +1669,7 @@ exports[`reported queue renders reported queue with comments 2`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -1698,7 +1690,6 @@ exports[`reported queue renders reported queue with comments 2`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -1864,7 +1855,7 @@ exports[`reported queue renders reported queue with comments 2`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -1885,7 +1876,6 @@ exports[`reported queue renders reported queue with comments 2`] = `
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -2057,7 +2047,7 @@ exports[`reported queue renders reported queue with comments and load more 1`] =
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -2078,7 +2068,6 @@ exports[`reported queue renders reported queue with comments and load more 1`] =
className="TextLink-root ModerateCard-link"
href="/admin/moderate/story-1"
onClick={[Function]}
target="_blank"
>
Moderate Story
</a>
@@ -2519,7 +2508,7 @@ exports[`single comment view accepts single comment 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -2687,7 +2676,7 @@ exports[`single comment view rejects single comment 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -2890,7 +2879,7 @@ exports[`single comment view renders single comment view 1`] = `
aria-hidden="true"
className="Icon-root Icon-xs TextLink-icon"
>
launch
open_in_new
</span>
</a>
</div>
@@ -191,7 +191,7 @@ it("change story status", async () => {
TestRenderer.act(() => {
within(popup)
.getByText("Closed")
.getByText("Closed", { selector: "button" })
.props.onClick();
});
@@ -205,7 +205,7 @@ it("change story status", async () => {
TestRenderer.act(() => {
within(popup)
.getByText("Open")
.getByText("Open", { selector: "button" })
.props.onClick();
});
@@ -22,13 +22,13 @@ const Username: FunctionComponent<{ username: string }> = ({ username }) => (
<strong>{username}</strong>
);
const ApprovedComment: FunctionComponent<Props> = props => (
const AcceptedComment: FunctionComponent<Props> = props => (
<DecisionItem icon={<AcceptedIcon />}>
<Localized
id="decisionHistory-acceptedCommentBy"
username={<Username username={props.username} />}
Username={<Username username={props.username} />}
>
<Info>{"Accepted comment by <username></username>"}</Info>
<Info>{"Accepted comment by <Username></Username>"}</Info>
</Localized>
<Footer>
<Typography variant="timestamp">
@@ -40,4 +40,4 @@ const ApprovedComment: FunctionComponent<Props> = props => (
</DecisionItem>
);
export default ApprovedComment;
export default AcceptedComment;
@@ -26,9 +26,9 @@ const RejectedComment: FunctionComponent<Props> = props => (
<DecisionItem icon={<RejectedIcon />}>
<Localized
id="decisionHistory-rejectedCommentBy"
username={<Username username={props.username} />}
Username={<Username username={props.username} />}
>
<Info>{"Rejected comment by <username></username>"}</Info>
<Info>{"Rejected comment by <Username></Username>"}</Info>
</Localized>
<Footer>
<Typography variant="timestamp">
@@ -5,15 +5,15 @@ exports[`renders correctly 1`] = `
icon={<AcceptedIcon />}
>
<Localized
id="decisionHistory-acceptedCommentBy"
username={
Username={
<Username
username="InTheExpensiveSeats"
/>
}
id="decisionHistory-acceptedCommentBy"
>
<Info>
Accepted comment by &lt;username&gt;&lt;/username&gt;
Accepted comment by &lt;Username&gt;&lt;/Username&gt;
</Info>
</Localized>
<Footer>
@@ -5,15 +5,15 @@ exports[`renders correctly 1`] = `
icon={<RejectedIcon />}
>
<Localized
id="decisionHistory-rejectedCommentBy"
username={
Username={
<Username
username="InTheExpensiveSeats"
/>
}
id="decisionHistory-rejectedCommentBy"
>
<Info>
Rejected comment by &lt;username&gt;&lt;/username&gt;
Rejected comment by &lt;Username&gt;&lt;/Username&gt;
</Info>
</Localized>
<Footer>
@@ -49,9 +49,9 @@ const SignIn: FunctionComponent<Props> = ({ username, onSignInAs }) => {
</Localized>
</div>
<div>
<Localized id="restricted-signedInAs" username={<Username />}>
<Localized id="restricted-signedInAs" Username={<Username />}>
<Typography variant="bodyCopy" align="center" container="div">
{"You are signed in as: <username></username>"}
{"You are signed in as: <Username></Username>"}
</Typography>
</Localized>
</div>
@@ -40,15 +40,15 @@ exports[`renders correctly 1`] = `
</div>
<div>
<Localized
Username={<Username />}
id="restricted-signedInAs"
username={<Username />}
>
<ForwardRef(forwardRef)
align="center"
container="div"
variant="bodyCopy"
>
You are signed in as: &lt;username&gt;&lt;/username&gt;
You are signed in as: &lt;Username&gt;&lt;/Username&gt;
</ForwardRef(forwardRef)>
</Localized>
</div>