Added server parsing of wildcards
Этот коммит содержится в:
@@ -5,9 +5,12 @@ package store
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/mattermost/platform/model"
|
"github.com/mattermost/platform/model"
|
||||||
"github.com/mattermost/platform/utils"
|
"github.com/mattermost/platform/utils"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SqlPostStore struct {
|
type SqlPostStore struct {
|
||||||
@@ -361,7 +364,7 @@ func (s SqlPostStore) getParentsPosts(channelId string, offset int, limit int) S
|
|||||||
|
|
||||||
var posts []*model.Post
|
var posts []*model.Post
|
||||||
_, err := s.GetReplica().Select(&posts,
|
_, err := s.GetReplica().Select(&posts,
|
||||||
`SELECT
|
`SELECT
|
||||||
q2.*
|
q2.*
|
||||||
FROM
|
FROM
|
||||||
Posts q2
|
Posts q2
|
||||||
@@ -369,7 +372,7 @@ func (s SqlPostStore) getParentsPosts(channelId string, offset int, limit int) S
|
|||||||
(SELECT DISTINCT
|
(SELECT DISTINCT
|
||||||
q3.RootId
|
q3.RootId
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
RootId
|
RootId
|
||||||
FROM
|
FROM
|
||||||
Posts
|
Posts
|
||||||
@@ -416,6 +419,12 @@ func (s SqlPostStore) Search(teamId string, userId string, terms string, isHasht
|
|||||||
// cannot escape it so we replace it.
|
// cannot escape it so we replace it.
|
||||||
terms = strings.Replace(terms, "@", " ", -1)
|
terms = strings.Replace(terms, "@", " ", -1)
|
||||||
|
|
||||||
|
// Parse text for wildcards
|
||||||
|
if wildcard, err := regexp.Compile("\\*($| )"); err == nil {
|
||||||
|
terms = wildcard.ReplaceAllLiteralString(terms, ":* ")
|
||||||
|
terms = strings.Replace(terms, " ", " ", -1)
|
||||||
|
}
|
||||||
|
|
||||||
var posts []*model.Post
|
var posts []*model.Post
|
||||||
|
|
||||||
if utils.Cfg.SqlSettings.DriverName == "postgres" {
|
if utils.Cfg.SqlSettings.DriverName == "postgres" {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user