From 20bc6cd35379be5bd5b17cd473093c39ab826739 Mon Sep 17 00:00:00 2001
From: Alexander Matyushentsev <Alexander_Matyushentsev@intuit.com>
Date: Thu, 15 Nov 2018 14:08:15 -0800
Subject: [PATCH] Full list of groups should include group names as well as
 group_name:team_name

---
 connector/github/github.go      | 5 ++---
 connector/github/github_test.go | 3 +++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/connector/github/github.go b/connector/github/github.go
index 5e9a302b..977d190f 100644
--- a/connector/github/github.go
+++ b/connector/github/github.go
@@ -391,9 +391,8 @@ func (c *githubConnector) userGroups(ctx context.Context, client *http.Client) (
 
 	groups := make([]string, 0)
 	for _, o := range orgs {
-		if teams, ok := orgTeams[o]; !ok {
-			groups = append(groups, o)
-		} else {
+		groups = append(groups, o)
+		if teams, ok := orgTeams[o]; ok {
 			for _, t := range teams {
 				groups = append(groups, formatTeamName(o, t))
 			}
diff --git a/connector/github/github_test.go b/connector/github/github_test.go
index e871c607..7069091d 100644
--- a/connector/github/github_test.go
+++ b/connector/github/github_test.go
@@ -53,9 +53,11 @@ func TestUserGroups(t *testing.T) {
 
 	expectNil(t, err)
 	expectEquals(t, groups, []string{
+		"org-1",
 		"org-1:team-1",
 		"org-1:team-2",
 		"org-1:team-3",
+		"org-2",
 		"org-2:team-4",
 		"org-3",
 	})
@@ -95,6 +97,7 @@ func TestUserGroupsWithTeamNameFieldConfig(t *testing.T) {
 
 	expectNil(t, err)
 	expectEquals(t, groups, []string{
+		"org-1",
 		"org-1:team-1",
 	})
 }
-- 
GitLab