1- From 343b5d5701076992bf2bf7f8d5160e387eb2f5c3 Mon Sep 17 00:00:00 2001
1+ From 8d0600f7eb914d9629e78b8f5250fb9307d2dd43 Mon Sep 17 00:00:00 2001
22From: Brecht Van Lommel <
[email protected] >
33Date: Fri, 10 May 2024 13:33:32 +0200
44Subject: [PATCH] BLENDER: Don't allow assigning large teams as reviewers
55
66To avoid accidentally spamming hundreds of people.
77---
8- models/organization/team.go | 16 ++++++++++++++++
9- routers/web/repo/issue.go | 4 ++--
10- services/repository/review .go | 2 +-
8+ models/organization/team.go | 16 ++++++++++++++++
9+ routers/web/repo/issue.go | 4 ++--
10+ services/pull/reviewer .go | 2 +-
1111 3 files changed, 19 insertions(+), 3 deletions(-)
1212
1313diff --git a/models/organization/team.go b/models/organization/team.go
14- index fb7f0c04939e6..be56a0428ec83 100644
14+ index fb7f0c0493..be56a0428e 100644
1515--- a/models/organization/team.go
1616+++ b/models/organization/team.go
1717@@ -272,3 +272,19 @@ func IncrTeamRepoNum(ctx context.Context, teamID int64) error {
@@ -35,12 +35,12 @@ index fb7f0c04939e6..be56a0428ec83 100644
3535+ return smallTeams, nil
3636+ }
3737diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
38- index cb233b787a690..bbc25ec8be915 100644
38+ index 3fdf594045..2f3660178c 100644
3939--- a/routers/web/repo/issue.go
4040+++ b/routers/web/repo/issue.go
41- @@ -3673 ,13 +3673 ,13 @@ func handleTeamMentions(ctx *context.Context) {
41+ @@ -3670 ,13 +3670 ,13 @@ func handleTeamMentions(ctx *context.Context) {
4242 }
43-
43+
4444 if isAdmin {
4545- teams, err = org.LoadTeams(ctx)
4646+ teams, err = organization.FilterLargeTeams(org.LoadTeams(ctx))
@@ -54,14 +54,17 @@ index cb233b787a690..bbc25ec8be915 100644
5454 if err != nil {
5555 ctx.ServerError("GetUserTeams", err)
5656 return
57- diff --git a/services/repository/review .go b/services/repository/review .go
58- index 40513e6bc67ba..f85424d60efa8 100644
59- --- a/services/repository/review .go
60- +++ b/services/repository/review .go
61- @@ -20 ,5 +20 ,5 @@ func GetReviewerTeams(ctx context.Context, repo *repo_model.Repository) ([]*orga
57+ diff --git a/services/pull/reviewer .go b/services/pull/reviewer .go
58+ index bf0d8cb298..c3b0858aa3 100644
59+ --- a/services/pull/reviewer .go
60+ +++ b/services/pull/reviewer .go
61+ @@ -85 ,5 +85 ,5 @@ func GetReviewerTeams(ctx context.Context, repo *repo_model.Repository) ([]*orga
6262 return nil, nil
6363 }
64-
65- - return organization.GetTeamsWithAccessToRepo (ctx, repo.OwnerID, repo.ID, perm.AccessModeRead)
66- + return organization.FilterLargeTeams(organization.GetTeamsWithAccessToRepo (ctx, repo.OwnerID, repo.ID, perm.AccessModeRead))
64+
65+ - return organization.GetTeamsWithAccessToRepoUnit (ctx, repo.OwnerID, repo.ID, perm.AccessModeRead, unit.TypePullRequests )
66+ + return organization.FilterLargeTeams(organization.GetTeamsWithAccessToRepoUnit (ctx, repo.OwnerID, repo.ID, perm.AccessModeRead, unit.TypePullRequests ))
6767 }
68+ - -
69+ 2.45.2
70+
0 commit comments