summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-03-07 09:37:00 -0500
committerGitHub <noreply@github.com>2017-03-07 09:37:00 -0500
commit33b8b72a026c54f121f1d0f0370d9ad2e6220a61 (patch)
tree005fe432e44b208a980f2b28a647e2ea48b6ed44 /api
parent115acb1fb1cef5dfe222af7f5ae02b5d1a9d9d4f (diff)
downloadchat-33b8b72a026c54f121f1d0f0370d9ad2e6220a61.tar.gz
chat-33b8b72a026c54f121f1d0f0370d9ad2e6220a61.tar.bz2
chat-33b8b72a026c54f121f1d0f0370d9ad2e6220a61.zip
Adding index and cache to reactinos store (#5654)
Diffstat (limited to 'api')
-rw-r--r--api/reaction.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/api/reaction.go b/api/reaction.go
index cc1e61efd..85b44b82d 100644
--- a/api/reaction.go
+++ b/api/reaction.go
@@ -4,12 +4,13 @@
package api
import (
+ "net/http"
+
l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
- "net/http"
)
func InitReaction() {
@@ -72,6 +73,8 @@ func saveReaction(c *Context, w http.ResponseWriter, r *http.Request) {
reaction := result.Data.(*model.Reaction)
+ app.InvalidateCacheForReactions(reaction.PostId)
+
w.Write([]byte(reaction.ToJson()))
}
}
@@ -126,6 +129,8 @@ func deleteReaction(c *Context, w http.ResponseWriter, r *http.Request) {
} else {
go sendReactionEvent(model.WEBSOCKET_EVENT_REACTION_REMOVED, channelId, reaction, post)
+ app.InvalidateCacheForReactions(reaction.PostId)
+
ReturnStatusOK(w)
}
}
@@ -179,7 +184,7 @@ func listReactions(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if result := <-app.Srv.Store.Reaction().GetForPost(postId); result.Err != nil {
+ if result := <-app.Srv.Store.Reaction().GetForPost(postId, true); result.Err != nil {
c.Err = result.Err
return
} else {