summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorAntti Ahti <antti.ahti@gmail.com>2015-10-14 18:27:03 +0300
committerAntti Ahti <antti.ahti@gmail.com>2015-10-14 18:27:03 +0300
commit1ab7034574de2229d3cfc49391e6579db37a3064 (patch)
tree64212e4e35cc06c6a9d24c53dad5843efea6a846 /api
parent830e8b04d9cbc5652ab8b23d469e1c75ff5f8516 (diff)
downloadchat-1ab7034574de2229d3cfc49391e6579db37a3064.tar.gz
chat-1ab7034574de2229d3cfc49391e6579db37a3064.tar.bz2
chat-1ab7034574de2229d3cfc49391e6579db37a3064.zip
Use team display name in team switcher menu
- /teams/find_teams returns team objects instead of just team names - use display_name in UI instead of name in the team switch menu
Diffstat (limited to 'api')
-rw-r--r--api/team.go8
-rw-r--r--api/team_test.go9
2 files changed, 9 insertions, 8 deletions
diff --git a/api/team.go b/api/team.go
index 6aa5ec1bb..7148caac3 100644
--- a/api/team.go
+++ b/api/team.go
@@ -409,14 +409,12 @@ func findTeams(c *Context, w http.ResponseWriter, r *http.Request) {
return
} else {
teams := result.Data.([]*model.Team)
-
- s := make([]string, 0, len(teams))
-
+ m := make(map[string]*model.Team)
for _, v := range teams {
- s = append(s, v.Name)
+ m[v.Id] = v
}
- w.Write([]byte(model.ArrayToJson(s)))
+ w.Write([]byte(model.TeamMapToJson(m)))
}
}
diff --git a/api/team_test.go b/api/team_test.go
index 9b701911b..507f4252a 100644
--- a/api/team_test.go
+++ b/api/team_test.go
@@ -121,9 +121,12 @@ func TestFindTeamByEmail(t *testing.T) {
if r1, err := Client.FindTeams(user.Email); err != nil {
t.Fatal(err)
} else {
- domains := r1.Data.([]string)
- if domains[0] != team.Name {
- t.Fatal(domains)
+ teams := r1.Data.(map[string]*model.Team)
+ if teams[team.Id].Name != team.Name {
+ t.Fatal()
+ }
+ if teams[team.Id].DisplayName != team.DisplayName {
+ t.Fatal()
}
}