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 ++++++++++++++++++++++ 2 files changed, 106 insertions(+) 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/admin/actions/email') 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 ( +
+
+

Send test email

+

+ To check whether your instance email configuration is correct, you can + try sending a test email to the given address, with an optional message. +
+ If you do not have SMTP configured for your instance, this will do nothing. +

+ + Learn more about SMTP configuration (opens in a new tab) + +
+ + + + + ); +} -- cgit v1.3