diff options
author | Corey Hulen <corey@hulen.com> | 2015-08-02 09:17:52 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-08-02 09:17:52 -0800 |
commit | 38e44e8f618b8e1af2ed2ded5efb5d3a887db279 (patch) | |
tree | ce64b8c8a70b4e819f5c28a5b25cd13eeb45f217 /model | |
parent | 4d1562c5de377741734a0ad4e8eb30a83d301262 (diff) | |
parent | c7a8112c172a55741e1dcbf366ed637543c301ce (diff) | |
download | chat-38e44e8f618b8e1af2ed2ded5efb5d3a887db279.tar.gz chat-38e44e8f618b8e1af2ed2ded5efb5d3a887db279.tar.bz2 chat-38e44e8f618b8e1af2ed2ded5efb5d3a887db279.zip |
Merge pull request #278 from mattermost/mm-1702
MM-1702 Adding etag to channel extra_info api call.
Diffstat (limited to 'model')
-rw-r--r-- | model/channel.go | 12 | ||||
-rw-r--r-- | model/client.go | 4 |
2 files changed, 13 insertions, 3 deletions
diff --git a/model/channel.go b/model/channel.go index ab36d46a2..94b8fdb43 100644 --- a/model/channel.go +++ b/model/channel.go @@ -27,6 +27,7 @@ type Channel struct { Description string `json:"description"` LastPostAt int64 `json:"last_post_at"` TotalMsgCount int64 `json:"total_msg_count"` + ExtraUpdateAt int64 `json:"extra_update_at"` } func (o *Channel) ToJson() string { @@ -50,7 +51,11 @@ func ChannelFromJson(data io.Reader) *Channel { } func (o *Channel) Etag() string { - return Etag(o.Id, o.LastPostAt) + return Etag(o.Id, o.UpdateAt) +} + +func (o *Channel) ExtraEtag() string { + return Etag(o.Id, o.ExtraUpdateAt) } func (o *Channel) IsValid() *AppError { @@ -97,8 +102,13 @@ func (o *Channel) PreSave() { o.CreateAt = GetMillis() o.UpdateAt = o.CreateAt + o.ExtraUpdateAt = o.CreateAt } func (o *Channel) PreUpdate() { o.UpdateAt = GetMillis() } + +func (o *Channel) ExtraUpdated() { + o.ExtraUpdateAt = GetMillis() +} diff --git a/model/client.go b/model/client.go index 17bb898ca..a5016fa2c 100644 --- a/model/client.go +++ b/model/client.go @@ -457,8 +457,8 @@ func (c *Client) UpdateLastViewedAt(channelId string) (*Result, *AppError) { } } -func (c *Client) GetChannelExtraInfo(id string) (*Result, *AppError) { - if r, err := c.DoGet("/channels/"+id+"/extra_info", "", ""); err != nil { +func (c *Client) GetChannelExtraInfo(id string, etag string) (*Result, *AppError) { + if r, err := c.DoGet("/channels/"+id+"/extra_info", "", etag); err != nil { return nil, err } else { return &Result{r.Header.Get(HEADER_REQUEST_ID), |