PLT-7404 Return viewed at times in view channel API response (#7428)

* Return viewed at times in view channel API response

* Updated transaction to read and write once

* Remove transaction and only update if new value greater than older
Этот коммит содержится в:
Joram Wilander
2017-09-29 11:45:59 -04:00
коммит произвёл Christopher Speller
родитель 5e50d3f461
Коммит 8b9dbb8613
9 изменённых файлов: 189 добавлений и 45 удалений

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

@@ -1570,13 +1570,13 @@ func (c *Client4) GetChannelMembersForUser(userId, teamId, etag string) (*Channe
}
// ViewChannel performs a view action for a user. Synonymous with switching channels or marking channels as read by a user.
func (c *Client4) ViewChannel(userId string, view *ChannelView) (bool, *Response) {
func (c *Client4) ViewChannel(userId string, view *ChannelView) (*ChannelViewResponse, *Response) {
url := fmt.Sprintf(c.GetChannelsRoute()+"/members/%v/view", userId)
if r, err := c.DoApiPost(url, view.ToJson()); err != nil {
return false, BuildErrorResponse(r, err)
return nil, BuildErrorResponse(r, err)
} else {
defer closeBody(r)
return CheckStatusOK(r), BuildResponse(r)
return ChannelViewResponseFromJson(r.Body), BuildResponse(r)
}
}