From c9a0030551f289241407743fbd21080cd8a358a4 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Wed, 30 Sep 2015 12:28:28 -0400 Subject: Moved ChannelMember.NotifyLevel into ChannelMember.NotifyProps --- model/channel_member.go | 6 +++--- model/channel_member_test.go | 7 +++---- model/client.go | 9 --------- 3 files changed, 6 insertions(+), 16 deletions(-) (limited to 'model') diff --git a/model/channel_member.go b/model/channel_member.go index f4a9a9836..3ae612700 100644 --- a/model/channel_member.go +++ b/model/channel_member.go @@ -27,7 +27,6 @@ type ChannelMember struct { MsgCount int64 `json:"msg_count"` MentionCount int64 `json:"mention_count"` NotifyProps StringMap `json:"notify_props"` - NotifyLevel string `json:"notify_level"` LastUpdateAt int64 `json:"last_update_at"` } @@ -67,8 +66,9 @@ func (o *ChannelMember) IsValid() *AppError { } } - if len(o.NotifyLevel) > 20 || !IsChannelNotifyLevelValid(o.NotifyLevel) { - return NewAppError("ChannelMember.IsValid", "Invalid notify level", "notify_level="+o.NotifyLevel) + notifyLevel := o.NotifyProps["desktop"] + if len(notifyLevel) > 20 || !IsChannelNotifyLevelValid(notifyLevel) { + return NewAppError("ChannelMember.IsValid", "Invalid notify level", "notify_level="+notifyLevel) } markUnreadLevel := o.NotifyProps["mark_unread"] diff --git a/model/channel_member_test.go b/model/channel_member_test.go index 5dc34ae56..edbb46e9b 100644 --- a/model/channel_member_test.go +++ b/model/channel_member_test.go @@ -31,7 +31,6 @@ func TestChannelMemberIsValid(t *testing.T) { } o.Roles = "missing" - o.NotifyLevel = CHANNEL_NOTIFY_ALL o.NotifyProps = GetDefaultChannelNotifyProps() o.UserId = NewId() if err := o.IsValid(); err == nil { @@ -39,17 +38,17 @@ func TestChannelMemberIsValid(t *testing.T) { } o.Roles = CHANNEL_ROLE_ADMIN - o.NotifyLevel = "junk" + o.NotifyProps["desktop"] = "junk" if err := o.IsValid(); err == nil { t.Fatal("should be invalid") } - o.NotifyLevel = "123456789012345678901" + o.NotifyProps["desktop"] = "123456789012345678901" if err := o.IsValid(); err == nil { t.Fatal("should be invalid") } - o.NotifyLevel = CHANNEL_NOTIFY_ALL + o.NotifyProps["desktop"] = CHANNEL_NOTIFY_ALL if err := o.IsValid(); err != nil { t.Fatal(err) } diff --git a/model/client.go b/model/client.go index bba839809..a291cc4f2 100644 --- a/model/client.go +++ b/model/client.go @@ -450,15 +450,6 @@ func (c *Client) UpdateChannelDesc(data map[string]string) (*Result, *AppError) } } -func (c *Client) UpdateNotifyLevel(data map[string]string) (*Result, *AppError) { - if r, err := c.DoApiPost("/channels/update_notify_level", 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) UpdateNotifyProps(data map[string]string) (*Result, *AppError) { if r, err := c.DoApiPost("/channels/update_notify_props", MapToJson(data)); err != nil { return nil, err -- cgit v1.2.3-1-g7c22