summaryrefslogtreecommitdiffstats
path: root/model/post.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2018-06-27 16:56:50 -0400
committerJoramWilander <jwawilander@gmail.com>2018-06-27 16:56:50 -0400
commit88c5e469ca869d9e8ceadb0f2b03e86005102f24 (patch)
treebbb1b4cc1312879476f222940651e4d3e763da9e /model/post.go
parentd7976549a0b45a42c04ac043a15677b7ca1228e9 (diff)
parent437f9f5b64ddb4e1f84e6c4e993120d074001777 (diff)
downloadchat-88c5e469ca869d9e8ceadb0f2b03e86005102f24.tar.gz
chat-88c5e469ca869d9e8ceadb0f2b03e86005102f24.tar.bz2
chat-88c5e469ca869d9e8ceadb0f2b03e86005102f24.zip
Merge branch 'master' into plugins-2
Diffstat (limited to 'model/post.go')
-rw-r--r--model/post.go17
1 files changed, 2 insertions, 15 deletions
diff --git a/model/post.go b/model/post.go
index 3d7a31ab5..1dd0a4db6 100644
--- a/model/post.go
+++ b/model/post.go
@@ -7,7 +7,6 @@ import (
"encoding/json"
"io"
"net/http"
- "regexp"
"sort"
"strings"
"unicode/utf8"
@@ -343,20 +342,8 @@ func PostPatchFromJson(data io.Reader) *PostPatch {
return &post
}
-var channelMentionRegexp = regexp.MustCompile(`\B~[a-zA-Z0-9\-_]+`)
-
-func (o *Post) ChannelMentions() (names []string) {
- if strings.Contains(o.Message, "~") {
- alreadyMentioned := make(map[string]bool)
- for _, match := range channelMentionRegexp.FindAllString(o.Message, -1) {
- name := match[1:]
- if !alreadyMentioned[name] {
- names = append(names, name)
- alreadyMentioned[name] = true
- }
- }
- }
- return
+func (o *Post) ChannelMentions() []string {
+ return ChannelMentions(o.Message)
}
func (r *PostActionIntegrationRequest) ToJson() string {