diff options
author | Corey Hulen <corey@hulen.com> | 2015-06-19 10:39:35 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-06-19 10:39:35 -0800 |
commit | 6e3fc268bc275146b95163ce2c3f4da465ef406c (patch) | |
tree | a7a0003142c76839f92545036b11554d695723c8 | |
parent | 8f0b6d6c36b3dd9d81b7d133b6a6908428496a5f (diff) | |
parent | 10ee355cd0d4c7c95c69de4697afd1cd99f730f7 (diff) | |
download | chat-6e3fc268bc275146b95163ce2c3f4da465ef406c.tar.gz chat-6e3fc268bc275146b95163ce2c3f4da465ef406c.tar.bz2 chat-6e3fc268bc275146b95163ce2c3f4da465ef406c.zip |
Merge pull request #36 from mattermost/notification-fix
HELIUM fix a bug where mentions wouldn't update for words after certain characters
-rw-r--r-- | api/post.go | 2 | ||||
-rw-r--r-- | model/utils.go | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/api/post.go b/api/post.go index 36607c231..3acc95551 100644 --- a/api/post.go +++ b/api/post.go @@ -302,7 +302,7 @@ func fireAndForgetNotifications(post *model.Post, teamId, teamUrl string) { // Build a map as a list of unique user_ids that are mentioned in this post splitF := func(c rune) bool { - return c == ',' || c == ' ' || c == '.' || c == '!' || c == '?' || c == ':' || c == '<' || c == '>' + return model.SplitRunes[c] } splitMessage := strings.FieldsFunc(strings.Replace(post.Message, "<br>", " ", -1), splitF) for _, word := range splitMessage { diff --git a/model/utils.go b/model/utils.go index 2541247de..262bda319 100644 --- a/model/utils.go +++ b/model/utils.go @@ -319,3 +319,5 @@ func ClearMentionTags(post string) string { var UrlRegex = regexp.MustCompile(`^((?:[a-z]+:\/\/)?(?:(?:[a-z0-9\-]+\.)+(?:[a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(?:\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(?:\?[a-z0-9+_~\-\.%=&]*)?)?(?:#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(?:\s+|$)$`) var PartialUrlRegex = regexp.MustCompile(`/api/v1/files/(get|get_image)/([A-Za-z0-9]{26})/([A-Za-z0-9]{26})/(([A-Za-z0-9]+/)?.+\.[A-Za-z0-9]{3,})`) + +var SplitRunes = map[rune]bool{',': true, ' ': true, '.': true, '!': true, '?': true, ':': true, ';': true, '\n': true, '<': true, '>': true, '(': true, ')': true, '{': true, '}': true, '[': true, ']': true, '+': true, '/': true, '\\': true} |