diff --git a/external/lang b/external/lang index 98592389..a8c77596 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit 98592389def635f69f54afeef0a576405239a902 +Subproject commit a8c77596457bcc6f24d0a764c308df74e12633af diff --git a/src/controllers/modals/ModalController.tsx b/src/controllers/modals/ModalController.tsx index cd97cf49..bb3a80f7 100644 --- a/src/controllers/modals/ModalController.tsx +++ b/src/controllers/modals/ModalController.tsx @@ -42,6 +42,7 @@ import ModifyAccount from "./components/ModifyAccount"; import OutOfDate from "./components/OutOfDate"; import PendingFriendRequests from "./components/PendingFriendRequests"; import ReportContent from "./components/Report"; +import ReportSuccess from "./components/ReportSuccess"; import ServerIdentity from "./components/ServerIdentity"; import ServerInfo from "./components/ServerInfo"; import ShowToken from "./components/ShowToken"; @@ -278,4 +279,5 @@ export const modalController = new ModalControllerExtended({ user_picker: UserPicker, user_profile: UserProfile, report: ReportContent, + report_success: ReportSuccess, }); diff --git a/src/controllers/modals/components/Report.tsx b/src/controllers/modals/components/Report.tsx index d2c5175d..f3441e74 100644 --- a/src/controllers/modals/components/Report.tsx +++ b/src/controllers/modals/components/Report.tsx @@ -8,6 +8,7 @@ import { ModalForm, Row } from "@revoltchat/ui"; import Message from "../../../components/common/messaging/Message"; import UserShort from "../../../components/common/user/UserShort"; import { useClient } from "../../client/ClientController"; +import { modalController } from "../ModalController"; import { ModalProps } from "../types"; const CONTENT_REASONS: API.ContentReportReason[] = [ @@ -126,6 +127,16 @@ export default function ReportContent({ }, additional_context, }); + + modalController.push({ + type: "report_success", + user: + target instanceof MessageInterface + ? target.author + : target instanceof User + ? target + : undefined, + }); }} submit={{ children: , diff --git a/src/controllers/modals/components/ReportSuccess.tsx b/src/controllers/modals/components/ReportSuccess.tsx new file mode 100644 index 00000000..9e1afd85 --- /dev/null +++ b/src/controllers/modals/components/ReportSuccess.tsx @@ -0,0 +1,65 @@ +import { Text } from "preact-i18n"; + +import { Modal } from "@revoltchat/ui"; + +import { noopTrue } from "../../../lib/js"; + +import { ModalProps } from "../types"; + +/** + * Report success modal + */ +export default function ReportSuccess({ + user, + ...props +}: ModalProps<"report_success">) { + return ( + } + description={ + <> + + {user && ( + <> +
+
+ + + )} + + } + actions={ + user + ? [ + { + palette: "plain", + onClick: async () => { + user.blockUser(); + return true; + }, + children: ( + + ), + }, + { + palette: "plain-secondary", + onClick: noopTrue, + children: ( + + ), + }, + ] + : [ + { + palette: "plain", + onClick: noopTrue, + children: ( + + ), + }, + ] + } + /> + ); +} diff --git a/src/controllers/modals/types.ts b/src/controllers/modals/types.ts index e09736a2..8cdfa375 100644 --- a/src/controllers/modals/types.ts +++ b/src/controllers/modals/types.ts @@ -183,6 +183,10 @@ export type Modal = { type: "report"; target: Server | User | Message; } + | { + type: "report_success"; + user?: User; + } ); export type ModalProps = Modal & { type: T } & {