From 2b4888d062d65546325470d2d9181f4a66a2fb00 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 22 Jun 2015 14:23:59 -0400 Subject: fixes mm-1316 improves channel notifications UI and updates channellist etag --- model/channel_list.go | 6 ++++++ model/channel_member.go | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'model') 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 } -- cgit v1.2.3-1-g7c22 From d090f5698addecf5e6a0380601ee5550563071c5 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 22 Jun 2015 14:38:35 -0400 Subject: update etag version --- model/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model') 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 -- cgit v1.2.3-1-g7c22 From 7b7e73fb9290a8084989a4219681c636670e7555 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 29 Jun 2015 14:37:59 -0400 Subject: added team-wide and channel-wide mentions --- model/user.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'model') diff --git a/model/user.go b/model/user.go index 794adcad4..ca62f3d72 100644 --- a/model/user.go +++ b/model/user.go @@ -148,9 +148,12 @@ func (u *User) SetDefaultNotifications() { u.NotifyProps["desktop"] = USER_NOTIFY_ALL u.NotifyProps["desktop_sound"] = "true" u.NotifyProps["mention_keys"] = u.Username - u.NotifyProps["first_name"] = "true" + 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 } -- cgit v1.2.3-1-g7c22 From 8be4df00b4d30c220d6f0d13734501c8c94e6495 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Tue, 30 Jun 2015 09:11:06 -0400 Subject: added mentioned username to default mention keys --- model/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model') diff --git a/model/user.go b/model/user.go index ca62f3d72..18fbb0d2a 100644 --- a/model/user.go +++ b/model/user.go @@ -147,7 +147,7 @@ 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["mention_keys"] = u.Username + ",@" + u.Username u.NotifyProps["first_name"] = "false" u.NotifyProps["all"] = "true" u.NotifyProps["channel"] = "true" -- cgit v1.2.3-1-g7c22 From bcc31b714b19ff3817c96c801028e23ace8cc55b Mon Sep 17 00:00:00 2001 From: nickago Date: Tue, 30 Jun 2015 11:56:55 -0700 Subject: Added the ability to have hashtags with dashes in them --- model/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model') diff --git a/model/utils.go b/model/utils.go index cc51dfe47..50e427694 100644 --- a/model/utils.go +++ b/model/utils.go @@ -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(`[.,()&$#!\[\]{}"':;\\]+$`) -- cgit v1.2.3-1-g7c22 From 233502eea87b8004d2bc15b872fcfa2bf508056d Mon Sep 17 00:00:00 2001 From: nickago Date: Wed, 1 Jul 2015 12:52:13 -0700 Subject: Changed offline timeout to 1 mintue --- model/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model') diff --git a/model/user.go b/model/user.go index 18fbb0d2a..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" -- cgit v1.2.3-1-g7c22