Skip to content

Commit

Permalink
Remove backtocomments button from illegal content report form
Browse files Browse the repository at this point in the history
  • Loading branch information
kabeaty committed Nov 9, 2023
1 parent 7131567 commit 81b2b64
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 65 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import { Localized } from "@fluent/react/compat";
import cn from "classnames";
import { FormApi } from "final-form";
import React, {
FunctionComponent,
MouseEvent,
useCallback,
useMemo,
useState,
} from "react";
import React, { FunctionComponent, useCallback, useState } from "react";
import { Field, Form } from "react-final-form";
import { graphql } from "react-relay";

import { getURLWithCommentID } from "coral-framework/helpers";
import { useUUID } from "coral-framework/hooks";
import { useCoralContext } from "coral-framework/lib/bootstrap";
import { parseBool } from "coral-framework/lib/form";
import { useMutation, withFragmentContainer } from "coral-framework/lib/relay";
import { required } from "coral-framework/lib/validation";
import CLASSES from "coral-stream/classes";
import UserBoxContainer from "coral-stream/common/UserBox";
import { ViewFullDiscussionEvent } from "coral-stream/events";
import { SetCommentIDMutation } from "coral-stream/mutations";
import { ArrowLeftIcon, ButtonSvgIcon } from "coral-ui/components/icons";
import {
CheckBox,
Flex,
Expand Down Expand Up @@ -64,9 +54,7 @@ interface FormProps {

const IllegalContentReportViewContainer: FunctionComponent<Props> = (props) => {
const { comment, story, viewer, settings } = props;
const setCommentID = useMutation(SetCommentIDMutation);
const createDSAReport = useMutation(CreateDSAReportMutation);
const { eventEmitter, window } = useCoralContext();
const [additionalComments, setAdditionalComments] = useState<
null | { id: string; url: string }[]
>(null);
Expand All @@ -76,23 +64,6 @@ const IllegalContentReportViewContainer: FunctionComponent<Props> = (props) => {
const [isSubmitted, setIsSubmitted] = useState(false);
const submissionID = useUUID();

const onShowAllComments = useCallback(
(e: MouseEvent<any>) => {
ViewFullDiscussionEvent.emit(eventEmitter, {
commentID: comment && comment.id,
});
void setCommentID({ id: null });
// TODO: remove view param too
e.preventDefault();
},
[comment, eventEmitter, setCommentID]
);

const showAllCommentsHref = useMemo(() => {
const url = window.location.href;
return getURLWithCommentID(url, undefined);
}, [window.location.href]);

const commentVisible = comment && isPublished(comment.status);

const onSubmit = useCallback(
Expand Down Expand Up @@ -186,40 +157,6 @@ const IllegalContentReportViewContainer: FunctionComponent<Props> = (props) => {
})}
>
<UserBoxContainer viewer={viewer} settings={settings} />
{showAllCommentsHref && (
<Localized
id="comments-permalinkView-reportIllegalContent-backToComments"
elems={{
Button: (
<ButtonSvgIcon
className={styles.leftIcon}
Icon={ArrowLeftIcon}
size="xs"
/>
),
}}
>
<Button
variant="flat"
color="primary"
fontSize="medium"
fontWeight="semiBold"
onClick={onShowAllComments}
href={showAllCommentsHref}
paddingSize="none"
target="_parent"
anchor
underline
>
<ButtonSvgIcon
className={styles.leftIcon}
Icon={ArrowLeftIcon}
size="xs"
/>
Back to comments
</Button>
</Localized>
)}
<Localized id="comments-permalinkView-reportIllegalContent-title">
<div className={styles.title}>Report illegal content</div>
</Localized>
Expand Down
1 change: 0 additions & 1 deletion locales/en-US/stream.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ comments-permalinkView-section =
comments-permalinkView-viewFullDiscussion = View full discussion
comments-permalinkView-commentRemovedOrDoesNotExist = This comment has been removed or does not exist.
comments-permalinkView-reportIllegalContent-backToComments = <Button></Button>Back to comments
comments-permalinkView-reportIllegalContent-title = Report illegal content
comments-permalinkView-reportIllegalContent-description = Under the Digital Services Act (DSA) you can
now report illegal content that you see in the comments. Please fill this form out to the best of
Expand Down

0 comments on commit 81b2b64

Please sign in to comment.