mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-28 13:53:32 -06: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:
parent
8c20ccd9a8
commit
4cd00d546c
31 changed files with 916 additions and 52 deletions
|
|
@ -24,6 +24,7 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/db"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
type EmojiTestSuite struct {
|
||||
|
|
@ -54,6 +55,8 @@ func (suite *EmojiTestSuite) TestGetEmojiByStaticURL() {
|
|||
suite.NoError(err)
|
||||
suite.NotNil(emoji)
|
||||
suite.Equal("rainbow", emoji.Shortcode)
|
||||
suite.NotNil(emoji.Category)
|
||||
suite.Equal("reactions", emoji.Category.Name)
|
||||
}
|
||||
|
||||
func (suite *EmojiTestSuite) TestGetAllEmojis() {
|
||||
|
|
@ -143,6 +146,21 @@ func (suite *EmojiTestSuite) TestGetSpecificEmojisFromDomain2() {
|
|||
suite.Equal("yell", emojis[0].Shortcode)
|
||||
}
|
||||
|
||||
func (suite *EmojiTestSuite) TestGetEmojiCategories() {
|
||||
categories, err := suite.db.GetEmojiCategories(context.Background())
|
||||
suite.NoError(err)
|
||||
suite.Len(categories, 2)
|
||||
// check alphabetical order
|
||||
suite.Equal(categories[0].Name, "cute stuff")
|
||||
suite.Equal(categories[1].Name, "reactions")
|
||||
}
|
||||
|
||||
func (suite *EmojiTestSuite) TestGetEmojiCategory() {
|
||||
category, err := suite.db.GetEmojiCategory(context.Background(), testrig.NewTestEmojiCategories()["reactions"].ID)
|
||||
suite.NoError(err)
|
||||
suite.NotNil(category)
|
||||
}
|
||||
|
||||
func TestEmojiTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(EmojiTestSuite))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue