From 78e7746ce7bd084fcf702542dbe7cc120e5704f1 Mon Sep 17 00:00:00 2001 From: Agustin Bettati Date: Thu, 10 Oct 2024 10:46:21 +0200 Subject: [PATCH 1/2] modify set structure and adjust comments --- internal/service/team/update_user.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/team/update_user.go b/internal/service/team/update_user.go index f96041b624..86c2f27679 100644 --- a/internal/service/team/update_user.go +++ b/internal/service/team/update_user.go @@ -54,20 +54,20 @@ func ValidateUsernames(c admin.MongoDBCloudUsersApi, usernames []string) ([]admi } func GetChangesForTeamUsers(currentUsers, newUsers []admin.CloudAppUser) (toAdd, toDelete []string, err error) { - // Create two sets to store the elements in A and B + // Create two sets to store the elements of current and new users currentUsersSet := InitUserSet(currentUsers) newUsersSet := InitUserSet(newUsers) - // Iterate over the elements in B and add them to the toAdd array if they are not in A + // Iterate over new users and add them to the toAdd array if they are not in current users for elem := range newUsersSet { - if _, ok := currentUsersSet[elem]; !ok { + if !currentUsersSet[elem] { toAdd = append(toAdd, elem) } } - // Iterate over the elements in A and add them to the toDelete array if they are not in B + // Iterate over current users and add them to the toDelete array if they are not in new users for elem := range currentUsersSet { - if _, ok := newUsersSet[elem]; !ok { + if !newUsersSet[elem] { toDelete = append(toDelete, elem) } } @@ -75,8 +75,8 @@ func GetChangesForTeamUsers(currentUsers, newUsers []admin.CloudAppUser) (toAdd, return toAdd, toDelete, nil } -func InitUserSet(users []admin.CloudAppUser) map[string]interface{} { - usersSet := make(map[string]interface{}, len(users)) +func InitUserSet(users []admin.CloudAppUser) map[string]bool { + usersSet := make(map[string]bool, len(users)) for i := 0; i < len(users); i++ { usersSet[users[i].GetId()] = true } From 43ce87902c78b848282775e042c72a14fc876598 Mon Sep 17 00:00:00 2001 From: Agustin Bettati Date: Thu, 10 Oct 2024 10:54:10 +0200 Subject: [PATCH 2/2] adding refactor as prefix that does not require changelog entry --- tools/check-changelog-entry-file/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check-changelog-entry-file/main.go b/tools/check-changelog-entry-file/main.go index c11edccd29..a7926ac78f 100644 --- a/tools/check-changelog-entry-file/main.go +++ b/tools/check-changelog-entry-file/main.go @@ -12,7 +12,7 @@ import ( var ( skipLabelName = "skip-changelog-check" - skipTitles = []string{"chore", "test", "doc", "ci"} // Dependabot uses chore. + skipTitles = []string{"chore", "test", "doc", "ci", "refactor"} // Dependabot uses chore. allowedTypeValues = getValidTypes("scripts/changelog/allowed-types.txt") typesRequireResourcePrefix = []string{"breaking-change", "enhancement", "bug"} )