From 9677a9f71777d75f3def0b0cb238050a30ec6a67 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 29 Jul 2015 01:26:10 -0800 Subject: Fixes mm-1355 adds rate limiting apis --- model/user.go | 1 + 1 file changed, 1 insertion(+) (limited to 'model') diff --git a/model/user.go b/model/user.go index c71d75405..ed5161538 100644 --- a/model/user.go +++ b/model/user.go @@ -51,6 +51,7 @@ type User struct { NotifyProps StringMap `json:"notify_props"` LastPasswordUpdate int64 `json:"last_password_update"` LastPictureUpdate int64 `json:"last_picture_update"` + FailedAttempts int `json:"failed_attempts"` } type GitLabUser struct { -- cgit v1.2.3-1-g7c22 From 3f97e06bf80c789ce8e2d572afdac65a73d417c8 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 29 Jul 2015 11:30:56 -0400 Subject: Adding etag to channel extra_info api call. --- model/channel.go | 12 +++++++++++- model/client.go | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'model') 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), -- cgit v1.2.3-1-g7c22