@ -239,11 +239,11 @@ type CreateReviewOptions struct {
// IsOfficialReviewer check if at least one of the provided reviewers can make official reviews in issue (counts towards required approvals)
// IsOfficialReviewer check if at least one of the provided reviewers can make official reviews in issue (counts towards required approvals)
func IsOfficialReviewer ( ctx context . Context , issue * Issue , reviewer * user_model . User ) ( bool , error ) {
func IsOfficialReviewer ( ctx context . Context , issue * Issue , reviewer * user_model . User ) ( bool , error ) {
pr , err := GetPullRequestByIssueID ( ctx , issue . ID )
if err := issue . LoadPullRequest ( ctx ) ; err != nil {
if err != nil {
return false , err
return false , err
}
}
pr := issue . PullRequest
rule , err := git_model . GetFirstMatchProtectedBranchRule ( ctx , pr . BaseRepoID , pr . BaseBranch )
rule , err := git_model . GetFirstMatchProtectedBranchRule ( ctx , pr . BaseRepoID , pr . BaseBranch )
if err != nil {
if err != nil {
return false , err
return false , err
@ -271,11 +271,10 @@ func IsOfficialReviewer(ctx context.Context, issue *Issue, reviewer *user_model.
// IsOfficialReviewerTeam check if reviewer in this team can make official reviews in issue (counts towards required approvals)
// IsOfficialReviewerTeam check if reviewer in this team can make official reviews in issue (counts towards required approvals)
func IsOfficialReviewerTeam ( ctx context . Context , issue * Issue , team * organization . Team ) ( bool , error ) {
func IsOfficialReviewerTeam ( ctx context . Context , issue * Issue , team * organization . Team ) ( bool , error ) {
pr , err := GetPullRequestByIssueID ( ctx , issue . ID )
if err := issue . LoadPullRequest ( ctx ) ; err != nil {
if err != nil {
return false , err
return false , err
}
}
pb , err := git_model . GetFirstMatchProtectedBranchRule ( ctx , pr . BaseRepoID , pr . BaseBranch )
pb , err := git_model . GetFirstMatchProtectedBranchRule ( ctx , issue . PullRequest . BaseRepoID , issue . PullRequest . BaseBranch )
if err != nil {
if err != nil {
return false , err
return false , err
}
}