summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/channel_list.go6
-rw-r--r--model/channel_member.go5
-rw-r--r--model/user.go15
-rw-r--r--model/utils.go4
4 files changed, 22 insertions, 8 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/user.go b/model/user.go
index 794adcad4..c516fae78 100644
--- a/model/user.go
+++ b/model/user.go
@@ -16,7 +16,7 @@ const (
ROLE_SYSTEM_ADMIN = "system_admin"
ROLE_SYSTEM_SUPPORT = "system_support"
USER_AWAY_TIMEOUT = 5 * 60 * 1000 // 5 minutes
- USER_OFFLINE_TIMEOUT = 5 * 60 * 1000 // 5 minutes
+ USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute
USER_OFFLINE = "offline"
USER_AWAY = "away"
USER_ONLINE = "online"
@@ -147,10 +147,13 @@ func (u *User) SetDefaultNotifications() {
u.NotifyProps["email"] = "true"
u.NotifyProps["desktop"] = USER_NOTIFY_ALL
u.NotifyProps["desktop_sound"] = "true"
- u.NotifyProps["mention_keys"] = u.Username
- u.NotifyProps["first_name"] = "true"
+ u.NotifyProps["mention_keys"] = u.Username + ",@" + u.Username
+ u.NotifyProps["first_name"] = "false"
+ u.NotifyProps["all"] = "true"
+ u.NotifyProps["channel"] = "true"
splitName := strings.Split(u.FullName, " ")
if len(splitName) > 0 && splitName[0] != "" {
+ u.NotifyProps["first_name"] = "true"
u.NotifyProps["mention_keys"] += "," + splitName[0]
}
}
@@ -277,17 +280,17 @@ func ComparePassword(hash string, password string) bool {
func IsUsernameValid(username string) bool {
- var restrictedUsernames = []string {
+ var restrictedUsernames = []string{
BOT_USERNAME,
"all",
"channel",
}
- for _,restrictedUsername := range restrictedUsernames {
+ for _, restrictedUsername := range restrictedUsernames {
if username == restrictedUsername {
return false
}
- }
+ }
return true
}
diff --git a/model/utils.go b/model/utils.go
index 262bda319..50e427694 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
@@ -260,7 +260,7 @@ func Etag(parts ...interface{}) string {
return etag
}
-var validHashtag = regexp.MustCompile(`^(#[A-Za-z]+[A-Za-z0-9_]*[A-Za-z0-9])$`)
+var validHashtag = regexp.MustCompile(`^(#[A-Za-z]+[A-Za-z0-9_\-]*[A-Za-z0-9])$`)
var puncStart = regexp.MustCompile(`^[.,()&$!\[\]{}"':;\\]+`)
var puncEnd = regexp.MustCompile(`[.,()&$#!\[\]{}"':;\\]+$`)