@@ -1374,6 +1374,8 @@ func teamUnitsRepoCond(id string, userID, orgID, teamID int64, units ...unit.Typ
1374
1374
"`team_unit`.org_id" : orgID ,
1375
1375
}.And (
1376
1376
builder .In ("`team_unit`.type" , units ),
1377
+ ).And (
1378
+ builder.Gt {"`team_unit`.access_mode" : int (perm .AccessModeNone )},
1377
1379
),
1378
1380
),
1379
1381
),
@@ -1402,17 +1404,64 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *organizati
1402
1404
} else {
1403
1405
cond = cond .And (
1404
1406
builder .Or (
1405
- repo_model .UserOwnedRepoCond (userID ), // owned repos
1406
- repo_model .UserAccessRepoCond (repoIDstr , userID ), // user can access repo in a unit independent way
1407
- repo_model . UserAssignedRepoCond ( repoIDstr , userID ), // user has been assigned accessible public repos
1408
- repo_model . UserMentionedRepoCond ( repoIDstr , userID ), // user has been mentioned accessible public repos
1409
- repo_model . UserCreateIssueRepoCond ( repoIDstr , userID , isPull ), // user has created issue/pr accessible public repos
1407
+ repo_model .UserOwnedRepoCond (userID ), // owned repos
1408
+ repo_model .UserUnitAccessRepoCond (repoIDstr , userID , unitType ), // user can access repo in a unit independent way
1409
+ UserAssignedIssueCond ( userID ), // user has been assigned accessible public repos
1410
+ UserMentionedIssueCond ( userID ), // user has been mentioned accessible public repos
1411
+ UserCreateIssueCond ( userID , isPull ), // user has created issue/pr accessible public repos
1410
1412
),
1411
1413
)
1412
1414
}
1413
1415
return cond
1414
1416
}
1415
1417
1418
+ // UserAssignedIssueCond return user as assignee issues list
1419
+ func UserAssignedIssueCond (userID int64 ) builder.Cond {
1420
+ return builder .And (
1421
+ builder.Eq {
1422
+ "repository.is_private" : false ,
1423
+ },
1424
+ builder .In ("issue.id" ,
1425
+ builder .Select ("issue_assignees.issue_id" ).From ("issue_assignees" ).
1426
+ Where (builder.Eq {
1427
+ "issue_assignees.assignee_id" : userID ,
1428
+ }),
1429
+ ),
1430
+ )
1431
+ }
1432
+
1433
+ // UserMentionedIssueCond return user metinoed issues list
1434
+ func UserMentionedIssueCond (userID int64 ) builder.Cond {
1435
+ return builder .And (
1436
+ builder.Eq {
1437
+ "repository.is_private" : false ,
1438
+ },
1439
+ builder .In ("issue.id" ,
1440
+ builder .Select ("issue_user.issue_id" ).From ("issue_user" ).
1441
+ Where (builder.Eq {
1442
+ "issue_user.is_mentioned" : true ,
1443
+ "issue_user.uid" : userID ,
1444
+ }),
1445
+ ),
1446
+ )
1447
+ }
1448
+
1449
+ // UserCreateIssueCond return user created issues list
1450
+ func UserCreateIssueCond (userID int64 , isPull bool ) builder.Cond {
1451
+ return builder .And (
1452
+ builder.Eq {
1453
+ "repository.is_private" : false ,
1454
+ },
1455
+ builder .In ("issue.id" ,
1456
+ builder .Select ("issue.id" ).From ("issue" ).
1457
+ Where (builder.Eq {
1458
+ "issue.poster_id" : userID ,
1459
+ "issue.is_pull" : isPull ,
1460
+ }),
1461
+ ),
1462
+ )
1463
+ }
1464
+
1416
1465
func applyAssigneeCondition (sess * xorm.Session , assigneeID int64 ) * xorm.Session {
1417
1466
return sess .Join ("INNER" , "issue_assignees" , "issue.id = issue_assignees.issue_id" ).
1418
1467
And ("issue_assignees.assignee_id = ?" , assigneeID )
0 commit comments