File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import (
1010
1111 "code.gitea.io/gitea/modules/setting"
1212 "code.gitea.io/gitea/modules/timeutil"
13- "code.gitea.io/gitea/modules/util"
1413
1514 "xorm.io/builder"
1615 "xorm.io/xorm"
@@ -100,7 +99,7 @@ type ReactionOptions struct {
10099
101100// CreateReaction creates reaction for issue or comment.
102101func CreateReaction (opts * ReactionOptions ) (reaction * Reaction , err error ) {
103- if ! util . IsStringInSlice ( opts . Type , setting .UI .Reactions ) {
102+ if ! setting .UI .ReactionsMap [ opts . Type ] {
104103 return nil , ErrForbiddenIssueReaction {opts .Type }
105104 }
106105
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ var (
171171 DefaultTheme string
172172 Themes []string
173173 Reactions []string
174+ ReactionsMap map [string ]bool
174175 SearchRepoDescription bool
175176 UseServiceWorker bool
176177
@@ -985,6 +986,11 @@ func NewContext() {
985986 U2F .AppID = sec .Key ("APP_ID" ).MustString (strings .TrimRight (AppURL , "/" ))
986987
987988 zip .Verbose = false
989+
990+ UI .ReactionsMap = make (map [string ]bool )
991+ for _ , reaction := range UI .Reactions {
992+ UI .ReactionsMap [reaction ] = true
993+ }
988994}
989995
990996func loadInternalToken (sec * ini.Section ) string {
You can’t perform that action at this time.
0 commit comments