diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/channel_list.go | 6 | ||||
-rw-r--r-- | model/channel_member.go | 5 | ||||
-rw-r--r-- | model/client.go | 18 | ||||
-rw-r--r-- | model/team.go | 1 | ||||
-rw-r--r-- | model/utils.go | 2 |
5 files changed, 31 insertions, 1 deletions
diff --git a/model/channel_list.go b/model/channel_list.go index 088dbea2a..09f14a986 100644 --- a/model/channel_list.go +++ b/model/channel_list.go @@ -53,6 +53,12 @@ func (o *ChannelList) Etag() string { t = member.LastViewedAt id = v.Id } + + if member.LastUpdateAt > t { + t = member.LastUpdateAt + id = v.Id + } + } } diff --git a/model/channel_member.go b/model/channel_member.go index 720ac4c42..50f51304b 100644 --- a/model/channel_member.go +++ b/model/channel_member.go @@ -25,6 +25,7 @@ type ChannelMember struct { MsgCount int64 `json:"msg_count"` MentionCount int64 `json:"mention_count"` NotifyLevel string `json:"notify_level"` + LastUpdateAt int64 `json:"last_update_at"` } func (o *ChannelMember) ToJson() string { @@ -70,6 +71,10 @@ func (o *ChannelMember) IsValid() *AppError { return nil } +func (o *ChannelMember) PreSave() { + o.LastUpdateAt = GetMillis() +} + func IsChannelNotifyLevelValid(notifyLevel string) bool { return notifyLevel == CHANNEL_NOTIFY_ALL || notifyLevel == CHANNEL_NOTIFY_MENTION || notifyLevel == CHANNEL_NOTIFY_NONE || notifyLevel == CHANNEL_NOTIFY_QUIET } diff --git a/model/client.go b/model/client.go index 0448828bb..ab01e7d62 100644 --- a/model/client.go +++ b/model/client.go @@ -186,6 +186,15 @@ func (c *Client) UpdateTeamName(data map[string]string) (*Result, *AppError) { } } +func (c *Client) UpdateValetFeature(data map[string]string) (*Result, *AppError) { + if r, err := c.DoPost("/teams/update_valet_feature", MapToJson(data)); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil + } +} + func (c *Client) CreateUser(user *User, hash string) (*Result, *AppError) { if r, err := c.DoPost("/users/create", user.ToJson()); err != nil { return nil, err @@ -647,6 +656,15 @@ func (c *Client) GetStatuses() (*Result, *AppError) { } } +func (c *Client) GetMyTeam(etag string) (*Result, *AppError) { + if r, err := c.DoGet("/teams/me", "", etag); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), TeamFromJson(r.Body)}, nil + } +} + func (c *Client) MockSession(sessionToken string) { c.AuthToken = sessionToken } diff --git a/model/team.go b/model/team.go index a510cde78..5c66f3b1f 100644 --- a/model/team.go +++ b/model/team.go @@ -24,6 +24,7 @@ type Team struct { Type string `json:"type"` CompanyName string `json:"company_name"` AllowedDomains string `json:"allowed_domains"` + AllowValet bool `json:"allow_valet"` } type Invites struct { diff --git a/model/utils.go b/model/utils.go index 262bda319..cc51dfe47 100644 --- a/model/utils.go +++ b/model/utils.go @@ -17,7 +17,7 @@ import ( ) const ( - ETAG_ROOT_VERSION = "10" + ETAG_ROOT_VERSION = "11" ) type StringMap map[string]string |