Skip to content

Commit 47cd3c4

Browse files
committed
fix
1 parent 9de196d commit 47cd3c4

File tree

6 files changed

+76
-42
lines changed

6 files changed

+76
-42
lines changed

models/fixtures/access.yml

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,150 +24,168 @@
2424

2525
-
2626
id: 5
27+
user_id: 2
28+
repo_id: 40
29+
mode: 4
30+
31+
-
32+
id: 6
33+
user_id: 2
34+
repo_id: 41
35+
mode: 4
36+
37+
-
38+
id: 7
2739
user_id: 4
2840
repo_id: 3
2941
mode: 2
3042

3143
-
32-
id: 6
44+
id: 8
3345
user_id: 4
3446
repo_id: 4
3547
mode: 2
3648

3749
-
38-
id: 7
50+
id: 9
3951
user_id: 4
4052
repo_id: 40
4153
mode: 2
4254

4355
-
44-
id: 8
56+
id: 10
57+
user_id: 5
58+
repo_id: 41
59+
mode: 2
60+
61+
-
62+
id: 11
4563
user_id: 10
4664
repo_id: 21
4765
mode: 2
4866

4967
-
50-
id: 9
68+
id: 12
5169
user_id: 10
5270
repo_id: 32
5371
mode: 2
5472

5573
-
56-
id: 10
74+
id: 13
5775
user_id: 15
5876
repo_id: 21
5977
mode: 2
6078

6179
-
62-
id: 11
80+
id: 14
6381
user_id: 15
6482
repo_id: 22
6583
mode: 2
6684

6785
-
68-
id: 12
86+
id: 15
6987
user_id: 15
7088
repo_id: 23
7189
mode: 4
7290

7391
-
74-
id: 13
92+
id: 16
7593
user_id: 15
7694
repo_id: 24
7795
mode: 4
7896

7997
-
80-
id: 14
98+
id: 17
8199
user_id: 15
82100
repo_id: 32
83101
mode: 2
84102

85103
-
86-
id: 15
104+
id: 18
87105
user_id: 18
88106
repo_id: 21
89107
mode: 2
90108

91109
-
92-
id: 16
110+
id: 19
93111
user_id: 18
94112
repo_id: 22
95113
mode: 2
96114

97115
-
98-
id: 17
116+
id: 20
99117
user_id: 18
100118
repo_id: 23
101119
mode: 4
102120

103121
-
104-
id: 18
122+
id: 21
105123
user_id: 18
106124
repo_id: 24
107125
mode: 4
108126

109127
-
110-
id: 19
128+
id: 22
111129
user_id: 20
112130
repo_id: 24
113131
mode: 1
114132

115133
-
116-
id: 20
134+
id: 23
117135
user_id: 20
118136
repo_id: 27
119137
mode: 4
120138

121139
-
122-
id: 21
140+
id: 24
123141
user_id: 20
124142
repo_id: 28
125143
mode: 4
126144

127145
-
128-
id: 22
146+
id: 25
129147
user_id: 29
130148
repo_id: 4
131149
mode: 2
132150

133151
-
134-
id: 23
152+
id: 26
135153
user_id: 29
136154
repo_id: 24
137155
mode: 1
138156

139157
-
140-
id: 24
158+
id: 27
141159
user_id: 31
142160
repo_id: 27
143161
mode: 4
144162

145163
-
146-
id: 25
164+
id: 28
147165
user_id: 31
148166
repo_id: 28
149167
mode: 4
150168

151169
-
152-
id: 26
170+
id: 29
153171
user_id: 38
154172
repo_id: 60
155173
mode: 2
156174

157175
-
158-
id: 27
176+
id: 30
159177
user_id: 38
160178
repo_id: 61
161179
mode: 1
162180

163181
-
164-
id: 28
182+
id: 31
165183
user_id: 39
166184
repo_id: 61
167185
mode: 1
168186

169187
-
170-
id: 29
188+
id: 32
171189
user_id: 40
172190
repo_id: 61
173191
mode: 4

models/fixtures/team.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
lower_name: team14writeauth
181181
name: team14WriteAuth
182182
authorize: 2 # write
183-
num_repos: 0
183+
num_repos: 1
184184
num_members: 1
185185
includes_all_repositories: false
186186
can_create_org_repo: true

models/fixtures/team_repo.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,11 @@
8585
-
8686
id: 15
8787
org_id: 23
88+
team_id: 17
89+
repo_id: 41
90+
91+
-
92+
id: 16
93+
org_id: 23
8894
team_id: 23
8995
repo_id: 41

models/issues/issue_project_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ func Test_LoadIssuesFromBoard(t *testing.T) {
2424
user5 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 5})
2525
user15 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 15})
2626

27-
org3 := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 3})
2827
org17 := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 17})
28+
org23 := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 23})
2929

3030
projectBoard1 := unittest.AssertExistsAndLoadBean(t, &project.Board{ID: 1})
3131
projectBoard4 := unittest.AssertExistsAndLoadBean(t, &project.Board{ID: 4})
@@ -87,28 +87,28 @@ func Test_LoadIssuesFromBoard(t *testing.T) {
8787
name: "organization public repo, repo project, org admin",
8888
board: projectBoard5,
8989
user: user15,
90-
org: nil,
90+
org: org17,
9191
expect: 1,
9292
},
9393
{
9494
name: "organization public repo, repo project, member",
9595
board: projectBoard5,
9696
user: user2,
97-
org: nil,
97+
org: org17,
9898
expect: 1,
9999
},
100100
{
101101
name: "organization public repo, repo project, login user",
102102
board: projectBoard5,
103103
user: user3,
104-
org: nil,
104+
org: org17,
105105
expect: 1,
106106
},
107107
{
108108
name: "organization public repo, repo project, non-login",
109109
board: projectBoard5,
110110
user: nil,
111-
org: nil,
111+
org: org17,
112112
expect: 1,
113113
},
114114
{
@@ -143,70 +143,70 @@ func Test_LoadIssuesFromBoard(t *testing.T) {
143143
name: "organization private repo, repo project, org admin",
144144
board: projectBoard7,
145145
user: user2,
146-
org: nil,
146+
org: org23,
147147
expect: 1,
148148
},
149149
{
150150
name: "organization private repo, repo project, member with issue access",
151151
board: projectBoard7,
152152
user: user5,
153-
org: nil,
153+
org: org23,
154154
expect: 1,
155155
},
156156
{
157157
name: "organization private repo, repo project, member without issue access",
158158
board: projectBoard7,
159159
user: user4,
160-
org: nil,
160+
org: org23,
161161
expect: 0,
162162
},
163163
{
164164
name: "organization private repo, repo project, login user",
165165
board: projectBoard7,
166166
user: user3,
167-
org: nil,
167+
org: org23,
168168
expect: 0,
169169
},
170170
{
171171
name: "organization private repo, repo project, non-login",
172172
board: projectBoard7,
173173
user: nil,
174-
org: nil,
174+
org: org23,
175175
expect: 0,
176176
},
177177
{
178178
name: "organization private repo, org project, org admin",
179179
board: projectBoard8,
180180
user: user2,
181-
org: org3,
181+
org: org23,
182182
expect: 1,
183183
},
184184
{
185185
name: "organization private repo, org project, member with issue access",
186186
board: projectBoard8,
187187
user: user5,
188-
org: org3,
188+
org: org23,
189189
expect: 1,
190190
},
191191
{
192192
name: "organization private repo, org project, member without issue access",
193193
board: projectBoard8,
194194
user: user4,
195-
org: org3,
195+
org: org23,
196196
expect: 0,
197197
},
198198
{
199199
name: "organization private repo, org project, login user",
200200
board: projectBoard8,
201201
user: user3,
202-
org: org3,
202+
org: org23,
203203
expect: 0,
204204
},
205205
{
206206
name: "organization private repo, org project, non-login",
207207
board: projectBoard8,
208208
user: nil,
209-
org: org3,
209+
org: org23,
210210
expect: 0,
211211
},
212212
}

models/issues/issue_search.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,12 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *organizati
328328
}
329329
if org != nil {
330330
if team != nil {
331-
cond = cond.And(teamUnitsRepoCond(repoIDstr, userID, org.ID, team.ID, unitType)) // special team member repos
331+
cond = cond.And(
332+
builder.Or(
333+
repo_model.PublicRepoCond(repoIDstr), // all public repos
334+
teamUnitsRepoCond(repoIDstr, userID, org.ID, team.ID, unitType), // special team member repos
335+
),
336+
)
332337
} else {
333338
cond = cond.And(
334339
builder.Or(

routers/web/repo/projects.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"code.gitea.io/gitea/models/db"
1414
issues_model "code.gitea.io/gitea/models/issues"
15+
"code.gitea.io/gitea/models/organization"
1516
"code.gitea.io/gitea/models/perm"
1617
project_model "code.gitea.io/gitea/models/project"
1718
repo_model "code.gitea.io/gitea/models/repo"
@@ -319,7 +320,11 @@ func ViewProject(ctx *context.Context) {
319320
boards[0].Title = ctx.Locale.TrString("repo.projects.type.uncategorized")
320321
}
321322

322-
issuesMap, err := issues_model.LoadIssuesFromBoardList(ctx, boards, ctx.Doer, nil)
323+
var org *organization.Organization
324+
if ctx.ContextUser.IsOrganization() {
325+
org = (*organization.Organization)(ctx.ContextUser)
326+
}
327+
issuesMap, err := issues_model.LoadIssuesFromBoardList(ctx, boards, ctx.Doer, org)
323328
if err != nil {
324329
ctx.ServerError("LoadIssuesOfBoards", err)
325330
return

0 commit comments

Comments
 (0)