[API] Expose allowed Reactions (#11735)
* [API] Expose allowed Reactions * dont be in soutch a rush * add TEST * use ElementsMatch Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
2842f6cf42
commit
b534a5164f
5 changed files with 75 additions and 0 deletions
|
@ -512,6 +512,9 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|||
m.Get("/signing-key.gpg", misc.SigningKey)
|
||||
m.Post("/markdown", bind(api.MarkdownOption{}), misc.Markdown)
|
||||
m.Post("/markdown/raw", misc.MarkdownRaw)
|
||||
m.Group("/settings", func() {
|
||||
m.Get("/allowed_reactions", misc.SettingGetsAllowedReactions)
|
||||
})
|
||||
|
||||
// Notifications
|
||||
m.Group("/notifications", func() {
|
||||
|
|
23
routers/api/v1/misc/settings.go
Normal file
23
routers/api/v1/misc/settings.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package misc
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
)
|
||||
|
||||
// SettingGetsAllowedReactions return allowed reactions
|
||||
func SettingGetsAllowedReactions(ctx *context.APIContext) {
|
||||
// swagger:operation GET /settings/allowed_reactions miscellaneous getAllowedReactions
|
||||
// ---
|
||||
// summary: Returns string array of allowed reactions
|
||||
// produces:
|
||||
// - application/json
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/StringSlice"
|
||||
ctx.JSON(200, setting.UI.Reactions)
|
||||
}
|
|
@ -14,3 +14,10 @@ type swaggerResponseServerVersion struct {
|
|||
// in:body
|
||||
Body api.ServerVersion `json:"body"`
|
||||
}
|
||||
|
||||
// StringSlice
|
||||
// swagger:response StringSlice
|
||||
type swaggerResponseStringSlice struct {
|
||||
// in:body
|
||||
Body []string `json:"body"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue