summaryrefslogtreecommitdiffstats
path: root/model/channel_member.go
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-09-23 11:38:08 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-09-30 09:59:58 -0400
commit7c319f052441c01f7c0ffd744a50b671c785591a (patch)
tree5c36d84eedd4b54801fbccd4419734eb0486f8d8 /model/channel_member.go
parent4bc625e8d10ab7735b76814fe9bbf3fb9144d4e1 (diff)
downloadchat-7c319f052441c01f7c0ffd744a50b671c785591a.tar.gz
chat-7c319f052441c01f7c0ffd744a50b671c785591a.tar.bz2
chat-7c319f052441c01f7c0ffd744a50b671c785591a.zip
Removed UI for quiet mode and added UI to set when a channel will be marked unread in the sidebar
Diffstat (limited to 'model/channel_member.go')
-rw-r--r--model/channel_member.go39
1 files changed, 25 insertions, 14 deletions
diff --git a/model/channel_member.go b/model/channel_member.go
index ac0b94ec4..1aafee43d 100644
--- a/model/channel_member.go
+++ b/model/channel_member.go
@@ -10,23 +10,26 @@ import (
)
const (
- CHANNEL_ROLE_ADMIN = "admin"
- CHANNEL_NOTIFY_DEFAULT = "default"
- CHANNEL_NOTIFY_ALL = "all"
- CHANNEL_NOTIFY_MENTION = "mention"
- CHANNEL_NOTIFY_NONE = "none"
- CHANNEL_NOTIFY_QUIET = "quiet" // TODO deprecate me
+ CHANNEL_ROLE_ADMIN = "admin"
+ CHANNEL_NOTIFY_DEFAULT = "default"
+ CHANNEL_NOTIFY_ALL = "all"
+ CHANNEL_NOTIFY_MENTION = "mention"
+ CHANNEL_NOTIFY_NONE = "none"
+ CHANNEL_NOTIFY_QUIET = "quiet" // no longer used, should be considered functionally equivalent to CHANNEL_NOTIFY_NONE
+ CHANNEL_MARK_UNREAD_ALL = "all"
+ CHANNEL_MARK_UNREAD_MENTION = "mention"
)
type ChannelMember struct {
- ChannelId string `json:"channel_id"`
- UserId string `json:"user_id"`
- Roles string `json:"roles"`
- LastViewedAt int64 `json:"last_viewed_at"`
- MsgCount int64 `json:"msg_count"`
- MentionCount int64 `json:"mention_count"`
- NotifyLevel string `json:"notify_level"`
- LastUpdateAt int64 `json:"last_update_at"`
+ ChannelId string `json:"channel_id"`
+ UserId string `json:"user_id"`
+ Roles string `json:"roles"`
+ LastViewedAt int64 `json:"last_viewed_at"`
+ MsgCount int64 `json:"msg_count"`
+ MentionCount int64 `json:"mention_count"`
+ NotifyLevel string `json:"notify_level"`
+ MarkUnreadLevel string `json:"mark_unread_level"`
+ LastUpdateAt int64 `json:"last_update_at"`
}
func (o *ChannelMember) ToJson() string {
@@ -69,6 +72,10 @@ func (o *ChannelMember) IsValid() *AppError {
return NewAppError("ChannelMember.IsValid", "Invalid notify level", "notify_level="+o.NotifyLevel)
}
+ if len(o.MarkUnreadLevel) > 20 || !IsChannelMarkUnreadLevelValid(o.MarkUnreadLevel) {
+ return NewAppError("ChannelMember.IsValid", "Invalid mark unread level", "mark_unread_level="+o.MarkUnreadLevel)
+ }
+
return nil
}
@@ -83,3 +90,7 @@ func IsChannelNotifyLevelValid(notifyLevel string) bool {
notifyLevel == CHANNEL_NOTIFY_NONE ||
notifyLevel == CHANNEL_NOTIFY_QUIET
}
+
+func IsChannelMarkUnreadLevelValid(markUnreadLevel string) bool {
+ return markUnreadLevel == CHANNEL_MARK_UNREAD_ALL || markUnreadLevel == CHANNEL_MARK_UNREAD_MENTION
+}