Update LastViewAt in create post API if not from a webhook (#3913)

Этот коммит содержится в:
enahum
2016-09-02 12:19:42 -03:00
коммит произвёл Christopher Speller
родитель 5d7f239962
Коммит ae46819b8e

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

@@ -76,8 +76,11 @@ func createPost(c *Context, w http.ResponseWriter, r *http.Request) {
return
} else {
if result := <-Srv.Store.Channel().UpdateLastViewedAt(post.ChannelId, c.Session.UserId); result.Err != nil {
l4g.Error(utils.T("api.post.create_post.last_viewed.error"), post.ChannelId, c.Session.UserId, result.Err)
// Update the LastViewAt only if the post does not have from_webhook prop set (eg. Zapier app)
if _, ok := post.Props["from_webhook"]; !ok {
if result := <-Srv.Store.Channel().UpdateLastViewedAt(post.ChannelId, c.Session.UserId); result.Err != nil {
l4g.Error(utils.T("api.post.create_post.last_viewed.error"), post.ChannelId, c.Session.UserId, result.Err)
}
}
w.Write([]byte(rp.ToJson()))