mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 02:22:26 -05:00
[feature] Allow emoji shortcode to be 1-character length (#3556)
* [feature] Allow emoji shortcode to be 1-character length * testerino fixeroni * spaghet
This commit is contained in:
parent
daf55ba6a5
commit
c2029df9bc
9 changed files with 17 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue