Merge pull request #110 from nickago/MM-1430
MM-1430 Added the ability to have hashtags with dashes in them
Этот коммит содержится в:
@@ -260,7 +260,7 @@ func Etag(parts ...interface{}) string {
|
|||||||
return etag
|
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 puncStart = regexp.MustCompile(`^[.,()&$!\[\]{}"':;\\]+`)
|
||||||
var puncEnd = regexp.MustCompile(`[.,()&$#!\[\]{}"':;\\]+$`)
|
var puncEnd = regexp.MustCompile(`[.,()&$#!\[\]{}"':;\\]+$`)
|
||||||
|
|
||||||
|
|||||||
@@ -356,9 +356,14 @@ func (s SqlPostStore) Search(teamId string, userId string, terms string, isHasht
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
result := StoreResult{}
|
result := StoreResult{}
|
||||||
|
termMap := map[string]bool{}
|
||||||
|
|
||||||
searchType := "Message"
|
searchType := "Message"
|
||||||
if isHashtagSearch {
|
if isHashtagSearch {
|
||||||
searchType = "Hashtags"
|
searchType = "Hashtags"
|
||||||
|
for _,term := range strings.Split(terms, " ") {
|
||||||
|
termMap[term] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ has a speical meaning in INNODB FULLTEXT indexes and
|
// @ has a speical meaning in INNODB FULLTEXT indexes and
|
||||||
@@ -394,6 +399,17 @@ func (s SqlPostStore) Search(teamId string, userId string, terms string, isHasht
|
|||||||
list := &model.PostList{Order: make([]string, 0, len(posts))}
|
list := &model.PostList{Order: make([]string, 0, len(posts))}
|
||||||
|
|
||||||
for _, p := range posts {
|
for _, p := range posts {
|
||||||
|
if searchType == "Hashtags" {
|
||||||
|
exactMatch := false
|
||||||
|
for _, tag := range strings.Split(p.Hashtags, " ") {
|
||||||
|
if termMap[tag] {
|
||||||
|
exactMatch = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !exactMatch {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
list.AddPost(p)
|
list.AddPost(p)
|
||||||
list.AddOrder(p.Id)
|
list.AddOrder(p.Id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -395,8 +395,8 @@ module.exports.textToJsx = function(text, options) {
|
|||||||
|
|
||||||
var inner = [];
|
var inner = [];
|
||||||
|
|
||||||
// Function specific regexes
|
// Function specific regex
|
||||||
var hashRegex = /^href="#[^"]+"|(#[A-Za-z]+[A-Za-z0-9_]*[A-Za-z0-9])$/g;
|
var hashRegex = /^href="#[^"]+"|(#[A-Za-z]+[A-Za-z0-9_\-]*[A-Za-z0-9])$/g;
|
||||||
|
|
||||||
var implicitKeywords = UserStore.getCurrentMentionKeys();
|
var implicitKeywords = UserStore.getCurrentMentionKeys();
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user