diff options
author | JoramWilander <jwawilander@gmail.com> | 2018-06-30 12:24:04 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2018-06-30 12:24:04 -0400 |
commit | 3848cb7e79e019e2f0878d6e2377ad36b3c7ca43 (patch) | |
tree | 98beeb962ffc6d7c3f8cd38651eaccab4a9685fa /api4 | |
parent | 88c5e469ca869d9e8ceadb0f2b03e86005102f24 (diff) | |
parent | 2362a5b7f7c2b4bf2b35b104e8616d847b33b0be (diff) | |
download | chat-3848cb7e79e019e2f0878d6e2377ad36b3c7ca43.tar.gz chat-3848cb7e79e019e2f0878d6e2377ad36b3c7ca43.tar.bz2 chat-3848cb7e79e019e2f0878d6e2377ad36b3c7ca43.zip |
Merge branch 'master' into plugins-2
Diffstat (limited to 'api4')
-rw-r--r-- | api4/user.go | 6 | ||||
-rw-r--r-- | api4/user_test.go | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/api4/user.go b/api4/user.go index 14ab3a0a2..ac702644d 100644 --- a/api4/user.go +++ b/api4/user.go @@ -154,7 +154,11 @@ func getUserByUsername(c *Context, w http.ResponseWriter, r *http.Request) { if c.HandleEtag(etag, "Get User", w, r) { return } else { - c.App.SanitizeProfile(user, c.IsSystemAdmin()) + if c.Session.UserId == user.Id { + user.Sanitize(map[string]bool{}) + } else { + c.App.SanitizeProfile(user, c.IsSystemAdmin()) + } w.Header().Set(model.HEADER_ETAG_SERVER, etag) w.Write([]byte(user.ToJson())) return diff --git a/api4/user_test.go b/api4/user_test.go index 96aa55d5f..ad77c8c4c 100644 --- a/api4/user_test.go +++ b/api4/user_test.go @@ -411,7 +411,7 @@ func TestGetUserByUsername(t *testing.T) { th.App.UpdateConfig(func(cfg *model.Config) { cfg.PrivacySettings.ShowEmailAddress = false }) th.App.UpdateConfig(func(cfg *model.Config) { cfg.PrivacySettings.ShowFullName = false }) - ruser, resp = Client.GetUserByUsername(user.Username, "") + ruser, resp = Client.GetUserByUsername(th.BasicUser2.Username, "") CheckNoError(t, resp) if ruser.Email != "" { @@ -424,6 +424,12 @@ func TestGetUserByUsername(t *testing.T) { t.Fatal("last name should be blank") } + ruser, resp = Client.GetUserByUsername(th.BasicUser.Username, "") + CheckNoError(t, resp) + if len(ruser.NotifyProps) == 0 { + t.Fatal("notify props should be sent") + } + Client.Logout() _, resp = Client.GetUserByUsername(user.Username, "") CheckUnauthorizedStatus(t, resp) |