diff options
author | 2024-11-21 12:13:55 +0100 | |
---|---|---|
committer | 2024-11-21 12:13:55 +0100 | |
commit | c2029df9bcfa05c19cf3644f2e686da35e267c68 (patch) | |
tree | 0b21c0bca8cc25743b2679ed5f026ed0afafd16f /web/source | |
parent | [chore] Bump cross-spawn from 7.0.3 to 7.0.6 in /web/source (#3552) (diff) | |
download | gotosocial-c2029df9bcfa05c19cf3644f2e686da35e267c68.tar.xz |
[feature] Allow emoji shortcode to be 1-character length (#3556)
* [feature] Allow emoji shortcode to be 1-character length
* testerino fixeroni
* spaghet
Diffstat (limited to 'web/source')
-rw-r--r-- | web/source/settings/views/admin/emoji/local/new-emoji.tsx | 2 | ||||
-rw-r--r-- | web/source/settings/views/admin/emoji/local/use-shortcode.ts | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/web/source/settings/views/admin/emoji/local/new-emoji.tsx b/web/source/settings/views/admin/emoji/local/new-emoji.tsx index b9c37ca8e..879a412bd 100644 --- a/web/source/settings/views/admin/emoji/local/new-emoji.tsx +++ b/web/source/settings/views/admin/emoji/local/new-emoji.tsx @@ -119,7 +119,7 @@ export default function NewEmojiForm() { label="Shortcode, must be unique among the instance's local emoji" autoCapitalize="none" spellCheck="false" - {...{pattern: "^\\w{2,30}$"}} + {...{pattern: "^\\w{1,30}$"}} /> <CategorySelect diff --git a/web/source/settings/views/admin/emoji/local/use-shortcode.ts b/web/source/settings/views/admin/emoji/local/use-shortcode.ts index 358e711b0..b304bb29a 100644 --- a/web/source/settings/views/admin/emoji/local/use-shortcode.ts +++ b/web/source/settings/views/admin/emoji/local/use-shortcode.ts @@ -22,7 +22,7 @@ import { useMemo } from "react"; import { useTextInput } from "../../../../lib/form"; import { useListEmojiQuery } from "../../../../lib/query/admin/custom-emoji"; -const shortcodeRegex = /^\w{2,30}$/; +const shortcodeRegex = /^\w{1,30}$/; export default function useShortcode() { const { data: emoji = [] } = useListEmojiQuery({ @@ -42,8 +42,8 @@ export default function useShortcode() { return "Shortcode already in use"; } - if (code.length < 2 || code.length > 30) { - return "Shortcode must be between 2 and 30 characters"; + if (code.length < 1 || code.length > 30) { + return "Shortcode must be between 1 and 30 characters"; } if (!shortcodeRegex.test(code)) { |