summaryrefslogtreecommitdiffstats
path: root/model/channel_member.go
diff options
context:
space:
mode:
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
+}