mirror of
https://github.com/mattermost/mattermost.git
synced 2026-08-26 21:27:40 -05:00
Increase performance when receiving posts in 3.6 (#5385)
This commit is contained in:
committed by
George Goldberg
parent
c5458f1609
commit
22bb594a2b
+9
-9
@@ -1257,12 +1257,11 @@ func viewChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if len(view.ChannelId) == 0 {
|
||||
ReturnStatusOK(w)
|
||||
return
|
||||
}
|
||||
channelIds := []string{}
|
||||
|
||||
channelIds := []string{view.ChannelId}
|
||||
if len(view.ChannelId) > 0 {
|
||||
channelIds = append(channelIds, view.ChannelId)
|
||||
}
|
||||
|
||||
var pchan store.StoreChannel
|
||||
if len(view.PrevChannelId) > 0 {
|
||||
@@ -1273,6 +1272,11 @@ func viewChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
if len(channelIds) == 0 {
|
||||
ReturnStatusOK(w)
|
||||
return
|
||||
}
|
||||
|
||||
uchan := Srv.Store.Channel().UpdateLastViewedAt(channelIds, c.Session.UserId)
|
||||
|
||||
if pchan != nil {
|
||||
@@ -1291,10 +1295,6 @@ func viewChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_VIEWED, c.TeamId, "", c.Session.UserId, nil)
|
||||
message.Add("channel_id", view.ChannelId)
|
||||
go Publish(message)
|
||||
|
||||
ReturnStatusOK(w)
|
||||
}
|
||||
|
||||
|
||||
@@ -99,11 +99,6 @@ func updateLastViewedAt(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Srv.Store.Preference().Save(&model.Preferences{teamPref, chanPref})
|
||||
|
||||
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_VIEWED, c.TeamId, "", c.Session.UserId, nil)
|
||||
message.Add("channel_id", id)
|
||||
|
||||
go Publish(message)
|
||||
|
||||
result := make(map[string]string)
|
||||
result["id"] = id
|
||||
w.Write([]byte(model.MapToJson(result)))
|
||||
@@ -134,11 +129,6 @@ func setLastViewedAt(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Srv.Store.Preference().Save(&model.Preferences{teamPref, chanPref})
|
||||
|
||||
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_VIEWED, c.TeamId, "", c.Session.UserId, nil)
|
||||
message.Add("channel_id", id)
|
||||
|
||||
go Publish(message)
|
||||
|
||||
result := make(map[string]string)
|
||||
result["id"] = id
|
||||
w.Write([]byte(model.MapToJson(result)))
|
||||
|
||||
Reference in New Issue
Block a user