summaryrefslogtreecommitdiffstats
path: root/api/user.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-12-26 09:38:34 -0500
committerChristopher Speller <crspeller@gmail.com>2016-12-26 09:38:34 -0500
commit6f4e6386fb0dc4f407e70e3d904bee1b09d54728 (patch)
treea153e73b7d5b6b3af9d98ef3002fce7edabeb402 /api/user.go
parentfa046ccf06c153acbbdb0af101248c2ce05c70d5 (diff)
downloadchat-6f4e6386fb0dc4f407e70e3d904bee1b09d54728.tar.gz
chat-6f4e6386fb0dc4f407e70e3d904bee1b09d54728.tar.bz2
chat-6f4e6386fb0dc4f407e70e3d904bee1b09d54728.zip
Don't autocomplete users by email (#4896)
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/api/user.go b/api/user.go
index 7e5a50fc4..5c44ec1f6 100644
--- a/api/user.go
+++ b/api/user.go
@@ -2859,7 +2859,17 @@ func autocompleteUsersInTeam(c *Context, w http.ResponseWriter, r *http.Request)
func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
term := r.URL.Query().Get("term")
- uchan := Srv.Store.User().Search("", term, map[string]bool{})
+ searchOptions := map[string]bool{}
+
+ hideFullName := !utils.Cfg.PrivacySettings.ShowFullName
+ if hideFullName && !HasPermissionToContext(c, model.PERMISSION_MANAGE_SYSTEM) {
+ searchOptions[store.USER_SEARCH_OPTION_NAMES_ONLY_NO_FULL_NAME] = true
+ c.Err = nil
+ } else {
+ searchOptions[store.USER_SEARCH_OPTION_NAMES_ONLY] = true
+ }
+
+ uchan := Srv.Store.User().Search("", term, searchOptions)
var profiles []*model.User