From a276b1ca06ce3ebfc201b9aaf3aa8c37c98fe584 Mon Sep 17 00:00:00 2001
From: tobi <31960611+tsmethurst@users.noreply.github.com>
Date: Mon, 27 May 2024 19:03:54 +0200
Subject: [feature/frontend] Let admins send test email to validate SMTP config
(#2934)
* [feature/frontend] Let admins send test email to validate SMTP config
* wee
---
.../settings/views/admin/actions/email/index.tsx | 29 ++++++++
.../settings/views/admin/actions/email/test.tsx | 77 ++++++++++++++++++++++
.../views/admin/actions/keys/expireremote.tsx | 25 ++++---
.../settings/views/admin/actions/keys/index.tsx | 5 +-
.../settings/views/admin/actions/media/cleanup.tsx | 22 +++++--
.../settings/views/admin/actions/media/index.tsx | 5 +-
web/source/settings/views/admin/menu.tsx | 8 ++-
web/source/settings/views/admin/router.tsx | 6 +-
8 files changed, 154 insertions(+), 23 deletions(-)
create mode 100644 web/source/settings/views/admin/actions/email/index.tsx
create mode 100644 web/source/settings/views/admin/actions/email/test.tsx
(limited to 'web/source/settings/views')
diff --git a/web/source/settings/views/admin/actions/email/index.tsx b/web/source/settings/views/admin/actions/email/index.tsx
new file mode 100644
index 000000000..e1b2fc759
--- /dev/null
+++ b/web/source/settings/views/admin/actions/email/index.tsx
@@ -0,0 +1,29 @@
+/*
+ GoToSocial
+ Copyright (C) GoToSocial Authors admin@gotosocial.org
+ SPDX-License-Identifier: AGPL-3.0-or-later
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+import React from "react";
+import Test from "./test";
+
+export default function Email() {
+ return (
+
+
+
+ );
+}
diff --git a/web/source/settings/views/admin/actions/email/test.tsx b/web/source/settings/views/admin/actions/email/test.tsx
new file mode 100644
index 000000000..09b7ed909
--- /dev/null
+++ b/web/source/settings/views/admin/actions/email/test.tsx
@@ -0,0 +1,77 @@
+/*
+ GoToSocial
+ Copyright (C) GoToSocial Authors admin@gotosocial.org
+ SPDX-License-Identifier: AGPL-3.0-or-later
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+import React from "react";
+import { TextInput } from "../../../../components/form/inputs";
+import MutationButton from "../../../../components/form/mutation-button";
+import { useTextInput } from "../../../../lib/form";
+import { useSendTestEmailMutation } from "../../../../lib/query/admin/actions";
+import { useInstanceV1Query } from "../../../../lib/query/gts-api";
+import useFormSubmit from "../../../../lib/form/submit";
+
+export default function Test({}) {
+ const { data: instance } = useInstanceV1Query();
+
+ const form = {
+ email: useTextInput("email", { defaultValue: instance?.email }),
+ message: useTextInput("message")
+ };
+
+ const [submit, result] = useFormSubmit(form, useSendTestEmailMutation(), { changedOnly: false });
+
+ return (
+
+ );
+}
diff --git a/web/source/settings/views/admin/actions/keys/expireremote.tsx b/web/source/settings/views/admin/actions/keys/expireremote.tsx
index 82045942c..d695ec0c8 100644
--- a/web/source/settings/views/admin/actions/keys/expireremote.tsx
+++ b/web/source/settings/views/admin/actions/keys/expireremote.tsx
@@ -21,7 +21,7 @@ import React from "react";
import { TextInput } from "../../../../components/form/inputs";
import MutationButton from "../../../../components/form/mutation-button";
import { useTextInput } from "../../../../lib/form";
-import { useInstanceKeysExpireMutation } from "../../../../lib/query/admin";
+import { useInstanceKeysExpireMutation } from "../../../../lib/query/admin/actions";
export default function ExpireRemote({}) {
const domainField = useTextInput("domain");
@@ -35,15 +35,20 @@ export default function ExpireRemote({}) {
return (