mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 14:52: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
|
|
@ -190,11 +190,11 @@ func CustomCSS(customCSS string) error {
|
|||
}
|
||||
|
||||
// EmojiShortcode just runs the given shortcode through the regular expression
|
||||
// for emoji shortcodes, to figure out whether it's a valid shortcode, ie., 2-30 characters,
|
||||
// for emoji shortcodes, to figure out whether it's a valid shortcode, ie., 1-30 characters,
|
||||
// a-zA-Z, numbers, and underscores.
|
||||
func EmojiShortcode(shortcode string) error {
|
||||
if !regexes.EmojiValidator.MatchString(shortcode) {
|
||||
return fmt.Errorf("shortcode %s did not pass validation, must be between 2 and 30 characters, letters, numbers, and underscores only", shortcode)
|
||||
return fmt.Errorf("shortcode %s did not pass validation, must be between 1 and 30 characters, letters, numbers, and underscores only", shortcode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ func (suite *ValidationTestSuite) TestValidateEmojiShortcode() {
|
|||
},
|
||||
{
|
||||
shortcode: "p",
|
||||
ok: false,
|
||||
ok: true,
|
||||
},
|
||||
{
|
||||
shortcode: "pp",
|
||||
|
|
@ -361,6 +361,10 @@ func (suite *ValidationTestSuite) TestValidateEmojiShortcode() {
|
|||
},
|
||||
{
|
||||
shortcode: "_",
|
||||
ok: true,
|
||||
},
|
||||
{
|
||||
shortcode: "",
|
||||
ok: false,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue