MM-11272 Added initial post metadata (#9175)
* MM-11272 Added app.PreparePostForClient * MM-11272 Added app.PreparePostListForClient * MM-11272 Added EmojiStore.GetMultipleByName * MM-11272 Added emojis to PreparePostForClient * MM-11272 Added unit tests for getting reaction counts * MM-11272 Added unit tests for TestPreparePostForClient * MM-11272 Added emojis from reactions to Post.Emojis * MM-11272 Always update post.UpdateAt when reactions change to bust cache * Fixed merge conflicts * Moved post metadata-related code into its own file * Update store mocks * Fixed typo * Add missing license headers * Updated post metadata tests when custom emojis are disabled * Fix unreliable unit tests * Fix inconsistent casing in SQL statements * Fix blank line * Invalidate store cache after making changes * Clear post cache synchronously with reactions
Этот коммит содержится в:
@@ -17,6 +17,8 @@ type Reaction struct {
|
||||
CreateAt int64 `json:"create_at"`
|
||||
}
|
||||
|
||||
type ReactionCounts map[string]int
|
||||
|
||||
func (o *Reaction) ToJson() string {
|
||||
b, _ := json.Marshal(o)
|
||||
return string(b)
|
||||
@@ -74,3 +76,13 @@ func (o *Reaction) PreSave() {
|
||||
o.CreateAt = GetMillis()
|
||||
}
|
||||
}
|
||||
|
||||
func CountReactions(reactions []*Reaction) ReactionCounts {
|
||||
reactionCounts := ReactionCounts{}
|
||||
|
||||
for _, reaction := range reactions {
|
||||
reactionCounts[reaction.EmojiName] += 1
|
||||
}
|
||||
|
||||
return reactionCounts
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user