1
- From 343b5d5701076992bf2bf7f8d5160e387eb2f5c3 Mon Sep 17 00:00:00 2001
1
+ From 8d0600f7eb914d9629e78b8f5250fb9307d2dd43 Mon Sep 17 00:00:00 2001
2
2
From: Brecht Van Lommel <
[email protected] >
3
3
Date: Fri, 10 May 2024 13:33:32 +0200
4
4
Subject: [PATCH] BLENDER: Don't allow assigning large teams as reviewers
5
5
6
6
To avoid accidentally spamming hundreds of people.
7
7
---
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 +-
11
11
3 files changed, 19 insertions(+), 3 deletions(-)
12
12
13
13
diff --git a/models/organization/team.go b/models/organization/team.go
14
- index fb7f0c04939e6..be56a0428ec83 100644
14
+ index fb7f0c0493..be56a0428e 100644
15
15
--- a/models/organization/team.go
16
16
+++ b/models/organization/team.go
17
17
@@ -272,3 +272,19 @@ func IncrTeamRepoNum(ctx context.Context, teamID int64) error {
@@ -35,12 +35,12 @@ index fb7f0c04939e6..be56a0428ec83 100644
35
35
+ return smallTeams, nil
36
36
+ }
37
37
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
38
- index cb233b787a690..bbc25ec8be915 100644
38
+ index 3fdf594045..2f3660178c 100644
39
39
--- a/routers/web/repo/issue.go
40
40
+++ 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) {
42
42
}
43
-
43
+
44
44
if isAdmin {
45
45
- teams, err = org.LoadTeams(ctx)
46
46
+ teams, err = organization.FilterLargeTeams(org.LoadTeams(ctx))
@@ -54,14 +54,17 @@ index cb233b787a690..bbc25ec8be915 100644
54
54
if err != nil {
55
55
ctx.ServerError("GetUserTeams", err)
56
56
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
62
62
return nil, nil
63
63
}
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 ))
67
67
}
68
+ - -
69
+ 2.45.2
70
+
0 commit comments