@@ -593,15 +593,19 @@ func (repo *Repository) getReviewers(e Engine, doerID, posterID int64) ([]*User,
593593 }
594594
595595 // 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
597597 if err := e .
598598 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 >= ? " +
600600 "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 ).
605609 Find (& users ); err != nil {
606610 return nil , err
607611 }
@@ -611,8 +615,8 @@ func (repo *Repository) getReviewers(e Engine, doerID, posterID int64) ([]*User,
611615
612616// GetReviewers get all users can be requested to review:
613617// * 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 .
616620// TODO: may be we should have a busy choice for users to block review request to them.
617621func (repo * Repository ) GetReviewers (doerID , posterID int64 ) ([]* User , error ) {
618622 return repo .getReviewers (x , doerID , posterID )
0 commit comments