mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Allow newly uploaded emojis to be placed in categories (#939)
* [feature] Add emoji categories GET Serialize emojis in appropriate categories; make it possible to get categories via the admin API * [feature] Create (or use existing) category for new emoji uploads * fix lint issue * update misleading line in swagger docs
This commit is contained in:
@ -42,6 +42,7 @@ const (
|
||||
maximumSiteTermsLength = 5000
|
||||
maximumUsernameLength = 64
|
||||
maximumCustomCSSLength = 5000
|
||||
maximumEmojiCategoryLength = 64
|
||||
)
|
||||
|
||||
// NewPassword returns an error if the given password is not sufficiently strong, or nil if it's ok.
|
||||
@ -182,6 +183,14 @@ func EmojiShortcode(shortcode string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EmojiCategory validates the length of the given category string.
|
||||
func EmojiCategory(category string) error {
|
||||
if length := len(category); length > maximumEmojiCategoryLength {
|
||||
return fmt.Errorf("emoji category %s did not pass validation, must be less than %d characters, but provided value was %d characters", category, maximumEmojiCategoryLength, length)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SiteTitle ensures that the given site title is within spec.
|
||||
func SiteTitle(siteTitle string) error {
|
||||
if length := len([]rune(siteTitle)); length > maximumSiteTitleLength {
|
||||
|
Reference in New Issue
Block a user