Skip to content

Commit d5a0c12

Browse files
committed
Remove unnecessary code and add some comments
1 parent 623c0c7 commit d5a0c12

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

services/pull/reviewer.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ func GetReviewers(ctx context.Context, repo *repo_model.Repository, doerID, post
5252
return nil, err
5353
}
5454
uniqueUserIDs.AddMultiple(additionalUserIDs...)
55-
} else {
56-
userIDs := make([]int64, 0, 10)
57-
if err := e.Table("access").
58-
Where("repo_id = ? AND mode >= ?", repo.ID, perm.AccessModeRead).
59-
Select("user_id").
60-
Find(&userIDs); err != nil {
61-
return nil, err
62-
}
63-
uniqueUserIDs.AddMultiple(userIDs...)
6455
}
6556

6657
uniqueUserIDs.Remove(posterID) // posterID should not be in the list of reviewers
@@ -76,6 +67,8 @@ func GetReviewers(ctx context.Context, repo *repo_model.Repository, doerID, post
7667
return nil, err
7768
}
7869
}
70+
71+
// add owner after all users are loaded because we can avoid load owner twice
7972
if repo.OwnerID != posterID && !repo.Owner.IsOrganization() && !uniqueUserIDs.Contains(repo.OwnerID) {
8073
users = append(users, repo.Owner)
8174
}

0 commit comments

Comments
 (0)