@@ -593,15 +593,19 @@ func (repo *Repository) getReviewers(e Engine, doerID, posterID int64) ([]*User,
593
593
}
594
594
595
595
// This is a "public" repository:
596
- // Any user that has write access or who is a watcher can be requested to review
596
+ // Any user that has read access, is a watcher or organization member can be requested to review
597
597
if err := e .
598
598
SQL ("SELECT * FROM `user` WHERE id IN ( " +
599
- "SELECT user_id FROM `access` WHERE repo_id = ? AND mode >= ? AND user_id NOT IN ( ?, ?) " +
599
+ "SELECT user_id FROM `access` WHERE repo_id = ? AND mode >= ? " +
600
600
"UNION " +
601
- "SELECT user_id FROM `watch` WHERE repo_id = ? AND user_id NOT IN ( ?, ?) AND mode IN (?, ?) " +
602
- ") ORDER BY name" ,
603
- repo .ID , AccessModeRead , doerID , posterID ,
604
- repo .ID , doerID , posterID , RepoWatchModeNormal , RepoWatchModeAuto ).
601
+ "SELECT user_id FROM `watch` WHERE repo_id = ? AND mode IN (?, ?) " +
602
+ "UNION " +
603
+ "SELECT uid AS user_id FROM `org_user` WHERE org_id = ? " +
604
+ ") AND id NOT IN (?, ?) ORDER BY name" ,
605
+ repo .ID , AccessModeRead ,
606
+ repo .ID , RepoWatchModeNormal , RepoWatchModeAuto ,
607
+ repo .OwnerID ,
608
+ doerID , posterID ).
605
609
Find (& users ); err != nil {
606
610
return nil , err
607
611
}
@@ -611,8 +615,8 @@ func (repo *Repository) getReviewers(e Engine, doerID, posterID int64) ([]*User,
611
615
612
616
// GetReviewers get all users can be requested to review:
613
617
// * for private repositories this returns all users that have read access or higher to the repository.
614
- // * for public repositories this returns all users that have write access or higher to the repository,
615
- // and all repo watchers.
618
+ // * for public repositories this returns all users that have read access or higher to the repository,
619
+ // all repo watchers and all organization members .
616
620
// TODO: may be we should have a busy choice for users to block review request to them.
617
621
func (repo * Repository ) GetReviewers (doerID , posterID int64 ) ([]* User , error ) {
618
622
return repo .getReviewers (x , doerID , posterID )
0 commit comments