mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-8354: Fix user search error when terms end up as empty space. (#7984)
This commit is contained in:
@@ -1078,7 +1078,7 @@ func (us SqlUserStore) performSearch(searchQuery string, term string, options ma
|
|||||||
searchQuery = strings.Replace(searchQuery, "INACTIVE_CLAUSE", "AND Users.DeleteAt = 0", 1)
|
searchQuery = strings.Replace(searchQuery, "INACTIVE_CLAUSE", "AND Users.DeleteAt = 0", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if term == "" {
|
if strings.TrimSpace(term) == "" {
|
||||||
searchQuery = strings.Replace(searchQuery, "SEARCH_CLAUSE", "", 1)
|
searchQuery = strings.Replace(searchQuery, "SEARCH_CLAUSE", "", 1)
|
||||||
} else {
|
} else {
|
||||||
isPostgreSQL := us.DriverName() == model.DATABASE_DRIVER_POSTGRES
|
isPostgreSQL := us.DriverName() == model.DATABASE_DRIVER_POSTGRES
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/model"
|
"github.com/mattermost/mattermost-server/model"
|
||||||
"github.com/mattermost/mattermost-server/store"
|
"github.com/mattermost/mattermost-server/store"
|
||||||
)
|
)
|
||||||
@@ -1817,6 +1819,10 @@ func testUserStoreSearch(t *testing.T, ss store.Store) {
|
|||||||
t.Fatal("should have found user")
|
t.Fatal("should have found user")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check PLT-8354 - search that ends up with just space for terms doesn't error.
|
||||||
|
r1 := <-ss.User().SearchWithoutTeam("* ", searchOptions)
|
||||||
|
assert.Nil(t, r1.Err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testUserStoreSearchWithoutTeam(t *testing.T, ss store.Store) {
|
func testUserStoreSearchWithoutTeam(t *testing.T, ss store.Store) {
|
||||||
|
|||||||
Reference in New Issue
Block a user