From 668eaf95d581f68507523563d0701000a4505055 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 1 Dec 2019 23:57:24 +0100 Subject: [Feature] Custom Reactions (#8886) * add [ui] Reactions * move contend check from form to go functions * use else if * check if reaction is allowed only on react (so previous custom reaction can be still removed) * use $.AllowedReactions in templates * use ctx.Flash.Error * use it there too * add redirection * back to server error because a wrong reaction is a template issue ... * add emoji list link * add docs entry * small wording nit suggestions from @jolheiser - thx * same reactions as github * fix PR reactions * handle error so template JS could check * Add Integrations Test * add REACTIONS setting to cheat-sheet doc page --- modules/auth/repo_form.go | 2 +- modules/setting/setting.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 1c873f2ea3..e3f6410c37 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -347,7 +347,7 @@ func (f *CreateCommentForm) Validate(ctx *macaron.Context, errs binding.Errors) // ReactionForm form for adding and removing reaction type ReactionForm struct { - Content string `binding:"Required;In(+1,-1,laugh,confused,heart,hooray)"` + Content string `binding:"Required"` } // Validate validates the fields diff --git a/modules/setting/setting.go b/modules/setting/setting.go index f2112f59f1..a97ab94677 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -169,6 +169,7 @@ var ( DefaultShowFullName bool DefaultTheme string Themes []string + Reactions []string SearchRepoDescription bool UseServiceWorker bool @@ -198,6 +199,7 @@ var ( MaxDisplayFileSize: 8388608, DefaultTheme: `gitea`, Themes: []string{`gitea`, `arc-green`}, + Reactions: []string{`+1`, `-1`, `laugh`, `hooray`, `confused`, `heart`, `rocket`, `eyes`}, Admin: struct { UserPagingNum int RepoPagingNum int -- cgit v1.2.3