From 1f39275c0f4ff3356a480ef7f0339d54547968e5 Mon Sep 17 00:00:00 2001 From: Julian-Samuel Gebühr Date: Fri, 2 Jun 2023 17:42:14 +0200 Subject: [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) --- web/source/settings/admin/emoji/local/use-shortcode.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'web/source/settings/admin/emoji/local/use-shortcode.js') 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 ""; -- cgit v1.2.3