summaryrefslogtreecommitdiff
path: root/web/source/settings/admin/emoji/local/use-shortcode.js
diff options
context:
space:
mode:
authorLibravatar Julian-Samuel Gebühr <julian-samuel@gebuehr.net>2023-06-02 17:42:14 +0200
committerLibravatar GitHub <noreply@github.com>2023-06-02 17:42:14 +0200
commit1f39275c0f4ff3356a480ef7f0339d54547968e5 (patch)
tree8ba20351dfc6b0f1a8caec4673ed658d7147b807 /web/source/settings/admin/emoji/local/use-shortcode.js
parent[bugfix] Overwrite API client closed errors with `499 - Client Closed Request... (diff)
downloadgotosocial-1f39275c0f4ff3356a480ef7f0339d54547968e5.tar.xz
[bugfix] Allow lowercase emoji shortcode in frontend (#1851)
* Replace pinafore with semaphore * Typo * Allow lowercase emoji shortcode in frontend * Fix failing test (corrected expected outcome)
Diffstat (limited to 'web/source/settings/admin/emoji/local/use-shortcode.js')
-rw-r--r--web/source/settings/admin/emoji/local/use-shortcode.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/web/source/settings/admin/emoji/local/use-shortcode.js b/web/source/settings/admin/emoji/local/use-shortcode.js
index d18edac56..c9c27cdf2 100644
--- a/web/source/settings/admin/emoji/local/use-shortcode.js
+++ b/web/source/settings/admin/emoji/local/use-shortcode.js
@@ -24,7 +24,7 @@ const React = require("react");
const query = require("../../../lib/query");
const { useTextInput } = require("../../../lib/form");
-const shortcodeRegex = /^[a-z0-9_]+$/;
+const shortcodeRegex = /^\w{2,30}$/;
module.exports = function useShortcode() {
const {
@@ -48,12 +48,8 @@ module.exports = function useShortcode() {
return "Shortcode must be between 2 and 30 characters";
}
- if (code.toLowerCase() != code) {
- return "Shortcode must be lowercase";
- }
-
if (!shortcodeRegex.test(code)) {
- return "Shortcode must only contain lowercase letters, numbers, and underscores";
+ return "Shortcode must only contain letters, numbers, and underscores";
}
return "";