diff options
author | 2022-11-14 23:47:27 +0100 | |
---|---|---|
committer | 2022-11-14 22:47:27 +0000 | |
commit | 4cd00d546c495b085487d11f2fe2c4928600dc10 (patch) | |
tree | 6605424baafddf020a4a6e0a0ddcde9293c1cb56 /internal/api/client/admin/emojicreate.go | |
parent | [chore] Remove unused `admin account suspend` action (#1047) (diff) | |
download | gotosocial-4cd00d546c495b085487d11f2fe2c4928600dc10.tar.xz |
[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
Diffstat (limited to 'internal/api/client/admin/emojicreate.go')
-rw-r--r-- | internal/api/client/admin/emojicreate.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/internal/api/client/admin/emojicreate.go b/internal/api/client/admin/emojicreate.go index b8dbfe43e..2a075708f 100644 --- a/internal/api/client/admin/emojicreate.go +++ b/internal/api/client/admin/emojicreate.go @@ -64,6 +64,15 @@ import ( // To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default. // type: file // required: true +// - +// name: category +// in: formData +// description: >- +// Category in which to place the new emoji. 64 characters or less. +// If left blank, emoji will be uncategorized. If a category with the +// given name doesn't exist yet, it will be created. +// type: string +// required: false // // security: // - OAuth2 Bearer: @@ -136,5 +145,9 @@ func validateCreateEmoji(form *model.EmojiCreateRequest) error { return fmt.Errorf("emoji image too large: image is %dKB but size limit for custom emojis is %dKB", form.Image.Size/1024, maxSize/1024) } - return validate.EmojiShortcode(form.Shortcode) + if err := validate.EmojiShortcode(form.Shortcode); err != nil { + return err + } + + return validate.EmojiCategory(form.CategoryName) } |