@@ -1374,6 +1374,8 @@ func teamUnitsRepoCond(id string, userID, orgID, teamID int64, units ...unit.Typ
13741374 "`team_unit`.org_id" : orgID ,
13751375 }.And (
13761376 builder .In ("`team_unit`.type" , units ),
1377+ ).And (
1378+ builder.Gt {"`team_unit`.access_mode" : int (perm .AccessModeNone )},
13771379 ),
13781380 ),
13791381 ),
@@ -1402,17 +1404,64 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *organizati
14021404 } else {
14031405 cond = cond .And (
14041406 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
14101412 ),
14111413 )
14121414 }
14131415 return cond
14141416}
14151417
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+
14161465func applyAssigneeCondition (sess * xorm.Session , assigneeID int64 ) * xorm.Session {
14171466 return sess .Join ("INNER" , "issue_assignees" , "issue.id = issue_assignees.issue_id" ).
14181467 And ("issue_assignees.assignee_id = ?" , assigneeID )
0 commit comments