File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -407,6 +407,17 @@ func (c *GenController) addReaction(u user.User) (res control.UserActionResponse
407
407
}
408
408
}
409
409
410
+ if reactionLimit := u .Store ().Config ().ServiceSettings .UniqueEmojiReactionLimitPerPost ; reactionLimit != nil {
411
+ uniqueEmojiNames := map [string ]bool {reaction .EmojiName : true }
412
+ for _ , r := range reactions {
413
+ uniqueEmojiNames [r .EmojiName ] = true
414
+ }
415
+
416
+ if len (uniqueEmojiNames ) >= * reactionLimit {
417
+ return control.UserActionResponse {Info : "reaction limit reached" }
418
+ }
419
+ }
420
+
410
421
err = u .SaveReaction (reaction )
411
422
if err != nil {
412
423
return control.UserActionResponse {Err : control .NewUserError (err )}
Original file line number Diff line number Diff line change @@ -825,6 +825,17 @@ func (c *SimulController) addReaction(u user.User) control.UserActionResponse {
825
825
}
826
826
}
827
827
828
+ if reactionLimit := u .Store ().Config ().ServiceSettings .UniqueEmojiReactionLimitPerPost ; reactionLimit != nil {
829
+ uniqueEmojiNames := map [string ]bool {reaction .EmojiName : true }
830
+ for _ , r := range reactions {
831
+ uniqueEmojiNames [r .EmojiName ] = true
832
+ }
833
+
834
+ if len (uniqueEmojiNames ) >= * reactionLimit {
835
+ return control.UserActionResponse {Info : "reaction limit reached" }
836
+ }
837
+ }
838
+
828
839
if u .SaveReaction (reaction ); err != nil {
829
840
return control.UserActionResponse {Err : control .NewUserError (err )}
830
841
}
You can’t perform that action at this time.
0 commit comments