[MM-55143] Disallow reacting with an emoji that does not exist, limit the total number of unique reactions per post (#25331)

* [MM-55143] Disallow reacting with an emoji that does not exist

* WIP for server limit on emoji reactions

* WIP

* Implement default limit of 25 unique emoji reactions

* Add modal for reaction limit

* Fix test

* PR feedback

* Fix i18n

* Update admin string

* Merge'd

* Fixing some issues, check limits correctly based on other users reactions

* Fix typos

* Fix lint/test

* Add tests, fix other tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Devin Binnie
2023-11-27 09:11:04 -05:00
коммит произвёл GitHub
родитель 0a38042d58
Коммит eaa5cce3ce
24 изменённых файлов: 652 добавлений и 29 удалений

Просмотреть файл

@@ -6745,6 +6745,22 @@ func (s *TimerLayerReactionStore) DeleteOrphanedRowsByIds(r *model.RetentionIdsF
return err
}
func (s *TimerLayerReactionStore) ExistsOnPost(postId string, emojiName string) (bool, error) {
start := time.Now()
result, err := s.ReactionStore.ExistsOnPost(postId, emojiName)
elapsed := float64(time.Since(start)) / float64(time.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.ExistsOnPost", success, elapsed)
}
return result, err
}
func (s *TimerLayerReactionStore) GetForPost(postID string, allowFromCache bool) ([]*model.Reaction, error) {
start := time.Now()
@@ -6777,6 +6793,22 @@ func (s *TimerLayerReactionStore) GetForPostSince(postId string, since int64, ex
return result, err
}
func (s *TimerLayerReactionStore) GetUniqueCountForPost(postId string) (int, error) {
start := time.Now()
result, err := s.ReactionStore.GetUniqueCountForPost(postId)
elapsed := float64(time.Since(start)) / float64(time.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.GetUniqueCountForPost", success, elapsed)
}
return result, err
}
func (s *TimerLayerReactionStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) {
start := time.Now()