diff options
author | enahum <nahumhbl@gmail.com> | 2016-09-02 12:19:42 -0300 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-09-02 11:19:42 -0400 |
commit | ae46819b8e988b99574cd9d98f7e526af0dfe225 (patch) | |
tree | 2c89147d3717600fa63fe75020c2335c462b1079 | |
parent | 5d7f2399620281dde1f4f85e1812aac9f18c96f9 (diff) | |
download | chat-ae46819b8e988b99574cd9d98f7e526af0dfe225.tar.gz chat-ae46819b8e988b99574cd9d98f7e526af0dfe225.tar.bz2 chat-ae46819b8e988b99574cd9d98f7e526af0dfe225.zip |
Update LastViewAt in create post API if not from a webhook (#3913)
-rw-r--r-- | api/post.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/api/post.go b/api/post.go index bfd22084b..55e63cd23 100644 --- a/api/post.go +++ b/api/post.go @@ -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())) |