From bbbf6ebe376c7b6c3a64e14571a3a477b880e3ad Mon Sep 17 00:00:00 2001
From: tobi <31960611+tsmethurst@users.noreply.github.com>
Date: Mon, 8 Jul 2024 09:38:27 +0200
Subject: [frontend] Better autocapitalize/spellcheck settings on forms (#3077)
---
.../views/moderation/accounts/detail/actions.tsx | 13 +++++--
.../settings/views/moderation/accounts/index.tsx | 16 +++++---
.../views/moderation/accounts/pending/index.tsx | 18 ++++++++-
.../views/moderation/accounts/search/index.tsx | 44 +++++++++++++++++++---
.../views/moderation/domain-permissions/detail.tsx | 32 +++++++++++++++-
.../views/moderation/domain-permissions/form.tsx | 5 ++-
.../moderation/domain-permissions/overview.tsx | 10 +++--
.../settings/views/moderation/reports/detail.tsx | 12 ++++--
8 files changed, 124 insertions(+), 26 deletions(-)
(limited to 'web/source/settings/views/moderation')
diff --git a/web/source/settings/views/moderation/accounts/detail/actions.tsx b/web/source/settings/views/moderation/accounts/detail/actions.tsx
index 4132b778a..ddcb1a5de 100644
--- a/web/source/settings/views/moderation/accounts/detail/actions.tsx
+++ b/web/source/settings/views/moderation/accounts/detail/actions.tsx
@@ -78,14 +78,21 @@ function ModerateAccount({ account }: { account: AdminAccount }) {
>
Account Moderation Actions
- Currently only the "suspend" action is implemented.
- Suspending an account will delete it from your server, and remove all of its media, posts, relationships, etc.
- If the suspended account is local, suspending will also send out a "delete" message to other servers, requesting them to remove its data from their instance as well.
+ Currently only the "suspend" action is implemented.
+
+ Suspending an account will delete it from your server,
+ and remove all of its media, posts, relationships, etc.
+
+ If the suspended account is local, suspending will also
+ send out a "delete" message to other servers, requesting
+ them to remove its data from their instance as well.
+
Account suspension cannot be reversed.
- Accounts Search
-
- You can perform actions on an account by clicking
- its name in a report, or by searching for the account
- using the form below and clicking on its name.
-
+
+
Accounts Search
+
+ You can perform actions on an account by clicking
+ its name in a report, or by searching for the account
+ using the form below and clicking on its name.
+
+ All fields in the below form are optional.
+
+
);
diff --git a/web/source/settings/views/moderation/accounts/pending/index.tsx b/web/source/settings/views/moderation/accounts/pending/index.tsx
index d47363954..f03c4800c 100644
--- a/web/source/settings/views/moderation/accounts/pending/index.tsx
+++ b/web/source/settings/views/moderation/accounts/pending/index.tsx
@@ -44,7 +44,23 @@ export default function AccountsPending() {
return (
-
Pending Accounts
+
{
+ if (v.length === 0) {
+ return "";
+ }
+
+ if (v[v.length-1] === ".") {
+ return "invalid domain";
+ }
+
+ const valid = isValidDomain(v, {
+ subdomain: true,
+ wildcard: false,
+ allowUnicode: true,
+ topLevel: false,
+ });
+
+ if (valid) {
+ return "";
+ }
+
+ return "invalid domain";
+ }
+ }),
email: useTextInput("email", { defaultValue: urlQueryParams.get("email") ?? ""}),
ip: useTextInput("ip", { defaultValue: urlQueryParams.get("ip") ?? ""}),
limit: useTextInput("limit", { defaultValue: urlQueryParams.get("limit") ?? "50"})
@@ -109,13 +134,17 @@ export function AccountSearchForm() {
>
{
+ if (v.length === 0) {
+ return "";
+ }
+
+ if (v[v.length-1] === ".") {
+ return "invalid domain";
+ }
+
+ const valid = isValidDomain(v, {
+ subdomain: true,
+ wildcard: false,
+ allowUnicode: true,
+ topLevel: false,
+ });
+
+ if (valid) {
+ return "";
+ }
+
+ return "invalid domain";
+ }
+ }),
obfuscate: useBoolInput("obfuscate", { source: perm }),
commentPrivate: useTextInput("private_comment", { source: perm }),
commentPublic: useTextInput("public_comment", { source: perm })
@@ -208,6 +234,8 @@ function DomainPermForm({ defaultDomain, perm, permType }: DomainPermFormProps)
field={form.domain}
label="Domain"
placeholder="example.com"
+ autoCapitalize="none"
+ spellCheck="false"
{...disabledForm}
/>
@@ -220,6 +248,7 @@ function DomainPermForm({ defaultDomain, perm, permType }: DomainPermFormProps)
@@ -227,6 +256,7 @@ function DomainPermForm({ defaultDomain, perm, permType }: DomainPermFormProps)
diff --git a/web/source/settings/views/moderation/domain-permissions/form.tsx b/web/source/settings/views/moderation/domain-permissions/form.tsx
index ea7fdbc23..204e9510c 100644
--- a/web/source/settings/views/moderation/domain-permissions/form.tsx
+++ b/web/source/settings/views/moderation/domain-permissions/form.tsx
@@ -80,9 +80,12 @@ export default function ImportExportForm({ form, submitParse, parseResult }: Imp
- Domain {permTypeUpper}s
- { permType == "block" ? : }
+
+
+
Domain {permTypeUpper}s
+ { permType == "block" ?
:
}
+
Or use the bulk import/export interface
- >
+
);
}
diff --git a/web/source/settings/views/moderation/reports/detail.tsx b/web/source/settings/views/moderation/reports/detail.tsx
index 7d6e542fb..298b5bd37 100644
--- a/web/source/settings/views/moderation/reports/detail.tsx
+++ b/web/source/settings/views/moderation/reports/detail.tsx
@@ -213,14 +213,18 @@ function ReportActionForm({ report }) {
This is useful for providing an explanation about what action was
taken (if any) before the report was marked as resolved.
-
- Any comment made here will be visible
- to the user that created the report!
-
+
+
+
+ If the report was created by a local account, then any
+ comment made here will be emailed to that account's user!
+
+
>