mirror of https://github.com/go-gitea/gitea.git
Merge eec070df04 into a440116a16
commit
ba4ed49b1e
@ -0,0 +1,168 @@
|
|||||||
|
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
org_model "code.gitea.io/gitea/models/organization"
|
||||||
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
var codeOwnerFiles = []string{"CODEOWNERS", "docs/CODEOWNERS", ".gitea/CODEOWNERS"}
|
||||||
|
|
||||||
|
func IsCodeOwnerFile(f string) bool {
|
||||||
|
return slices.Contains(codeOwnerFiles, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetCodeOwnerFiles() []string {
|
||||||
|
return codeOwnerFiles
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCodeOwnersFromContent returns the code owners configuration
|
||||||
|
// Return empty slice if files missing
|
||||||
|
// Return warning messages on parsing errors
|
||||||
|
// We're trying to do the best we can when parsing a file.
|
||||||
|
// Invalid lines are skipped. Non-existent users and teams too.
|
||||||
|
func GetCodeOwnersFromContent(ctx context.Context, data string) ([]*CodeOwnerRule, []string) {
|
||||||
|
if len(data) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
rules := make([]*CodeOwnerRule, 0)
|
||||||
|
lines := strings.Split(data, "\n")
|
||||||
|
warnings := make([]string, 0)
|
||||||
|
|
||||||
|
for i, line := range lines {
|
||||||
|
tokens := TokenizeCodeOwnersLine(line)
|
||||||
|
if len(tokens) == 0 {
|
||||||
|
continue
|
||||||
|
} else if len(tokens) < 2 {
|
||||||
|
warnings = append(warnings, fmt.Sprintf("Line: %d: incorrect format", i+1))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
rule, wr := ParseCodeOwnersLine(ctx, tokens)
|
||||||
|
for _, w := range wr {
|
||||||
|
warnings = append(warnings, fmt.Sprintf("Line: %d: %s", i+1, w))
|
||||||
|
}
|
||||||
|
if rule == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
rules = append(rules, rule)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rules, warnings
|
||||||
|
}
|
||||||
|
|
||||||
|
type CodeOwnerRule struct {
|
||||||
|
Rule *regexp.Regexp
|
||||||
|
Negative bool
|
||||||
|
Users []*user_model.User
|
||||||
|
Teams []*org_model.Team
|
||||||
|
}
|
||||||
|
|
||||||
|
func ParseCodeOwnersLine(ctx context.Context, tokens []string) (*CodeOwnerRule, []string) {
|
||||||
|
var err error
|
||||||
|
rule := &CodeOwnerRule{
|
||||||
|
Users: make([]*user_model.User, 0),
|
||||||
|
Teams: make([]*org_model.Team, 0),
|
||||||
|
Negative: strings.HasPrefix(tokens[0], "!"),
|
||||||
|
}
|
||||||
|
|
||||||
|
warnings := make([]string, 0)
|
||||||
|
|
||||||
|
rule.Rule, err = regexp.Compile(fmt.Sprintf("^%s$", strings.TrimPrefix(tokens[0], "!")))
|
||||||
|
if err != nil {
|
||||||
|
warnings = append(warnings, fmt.Sprintf("incorrect codeowner regexp: %s", err))
|
||||||
|
return nil, warnings
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, user := range tokens[1:] {
|
||||||
|
user = strings.TrimPrefix(user, "@")
|
||||||
|
|
||||||
|
// Only @org/team can contain slashes
|
||||||
|
if strings.Contains(user, "/") {
|
||||||
|
s := strings.Split(user, "/")
|
||||||
|
if len(s) != 2 {
|
||||||
|
warnings = append(warnings, "incorrect codeowner group: "+user)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
orgName := s[0]
|
||||||
|
teamName := s[1]
|
||||||
|
|
||||||
|
org, err := org_model.GetOrgByName(ctx, orgName)
|
||||||
|
if err != nil {
|
||||||
|
warnings = append(warnings, "incorrect codeowner organization: "+user)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
teams, err := org.LoadTeams(ctx)
|
||||||
|
if err != nil {
|
||||||
|
warnings = append(warnings, "incorrect codeowner team: "+user)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, team := range teams {
|
||||||
|
if team.Name == teamName {
|
||||||
|
rule.Teams = append(rule.Teams, team)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
u, err := user_model.GetUserByName(ctx, user)
|
||||||
|
if err != nil {
|
||||||
|
warnings = append(warnings, "incorrect codeowner user: "+user)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
rule.Users = append(rule.Users, u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len(rule.Users) == 0) && (len(rule.Teams) == 0) {
|
||||||
|
warnings = append(warnings, "no users/groups matched")
|
||||||
|
return nil, warnings
|
||||||
|
}
|
||||||
|
|
||||||
|
return rule, warnings
|
||||||
|
}
|
||||||
|
|
||||||
|
func TokenizeCodeOwnersLine(line string) []string {
|
||||||
|
if len(line) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
line = strings.TrimSpace(line)
|
||||||
|
line = strings.ReplaceAll(line, "\t", " ")
|
||||||
|
|
||||||
|
tokens := make([]string, 0)
|
||||||
|
|
||||||
|
escape := false
|
||||||
|
token := ""
|
||||||
|
for _, char := range line {
|
||||||
|
if escape {
|
||||||
|
token += string(char)
|
||||||
|
escape = false
|
||||||
|
} else if string(char) == "\\" {
|
||||||
|
escape = true
|
||||||
|
} else if string(char) == "#" {
|
||||||
|
break
|
||||||
|
} else if string(char) == " " {
|
||||||
|
if len(token) > 0 {
|
||||||
|
tokens = append(tokens, token)
|
||||||
|
token = ""
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
token += string(char)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(token) > 0 {
|
||||||
|
tokens = append(tokens, token)
|
||||||
|
}
|
||||||
|
|
||||||
|
return tokens
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestParseCodeOwnersLine(t *testing.T) {
|
||||||
|
type CodeOwnerTest struct {
|
||||||
|
Line string
|
||||||
|
Tokens []string
|
||||||
|
}
|
||||||
|
|
||||||
|
given := []CodeOwnerTest{
|
||||||
|
{Line: "", Tokens: nil},
|
||||||
|
{Line: "# comment", Tokens: []string{}},
|
||||||
|
{Line: "!.* @user1 @org1/team1", Tokens: []string{"!.*", "@user1", "@org1/team1"}},
|
||||||
|
{Line: `.*\\.js @user2 #comment`, Tokens: []string{`.*\.js`, "@user2"}},
|
||||||
|
{Line: `docs/(aws|google|azure)/[^/]*\\.(md|txt) @org3 @org2/team2`, Tokens: []string{`docs/(aws|google|azure)/[^/]*\.(md|txt)`, "@org3", "@org2/team2"}},
|
||||||
|
{Line: `\#path @org3`, Tokens: []string{`#path`, "@org3"}},
|
||||||
|
{Line: `path\ with\ spaces/ @org3`, Tokens: []string{`path with spaces/`, "@org3"}},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, g := range given {
|
||||||
|
tokens := TokenizeCodeOwnersLine(g.Line)
|
||||||
|
assert.Equal(t, g.Tokens, tokens, "Codeowners tokenizer failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,314 @@
|
|||||||
|
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package pull
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
issues_model "code.gitea.io/gitea/models/issues"
|
||||||
|
org_model "code.gitea.io/gitea/models/organization"
|
||||||
|
"code.gitea.io/gitea/models/perm"
|
||||||
|
access_model "code.gitea.io/gitea/models/perm/access"
|
||||||
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
|
"code.gitea.io/gitea/models/unit"
|
||||||
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
notify_service "code.gitea.io/gitea/services/notify"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReviewRequest add or remove a review request from a user for this PR, and make comment for it.
|
||||||
|
func ReviewRequest(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, permDoer *access_model.Permission, reviewer *user_model.User, isAdd bool) (comment *issues_model.Comment, err error) {
|
||||||
|
err = isValidReviewRequest(ctx, reviewer, doer, isAdd, issue, permDoer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if isAdd {
|
||||||
|
comment, err = issues_model.AddReviewRequest(ctx, issue, reviewer, doer)
|
||||||
|
} else {
|
||||||
|
comment, err = issues_model.RemoveReviewRequest(ctx, issue, reviewer, doer)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if comment != nil {
|
||||||
|
notify_service.PullRequestReviewRequest(ctx, doer, issue, reviewer, isAdd, comment)
|
||||||
|
}
|
||||||
|
|
||||||
|
return comment, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// isValidReviewRequest Check permission for ReviewRequest
|
||||||
|
func isValidReviewRequest(ctx context.Context, reviewer, doer *user_model.User, isAdd bool, issue *issues_model.Issue, permDoer *access_model.Permission) error {
|
||||||
|
if reviewer.IsOrganization() {
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Organization can't be added as reviewer",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if doer.IsOrganization() {
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Organization can't be doer to add reviewer",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
permReviewer, err := access_model.GetUserRepoPermission(ctx, issue.Repo, reviewer)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if permDoer == nil {
|
||||||
|
permDoer = new(access_model.Permission)
|
||||||
|
*permDoer, err = access_model.GetUserRepoPermission(ctx, issue.Repo, doer)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastReview, err := issues_model.GetReviewByIssueIDAndUserID(ctx, issue.ID, reviewer.ID)
|
||||||
|
if err != nil && !issues_model.IsErrReviewNotExist(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
canDoerChangeReviewRequests := CanDoerChangeReviewRequests(ctx, doer, issue.Repo, issue.PosterID)
|
||||||
|
|
||||||
|
if isAdd {
|
||||||
|
if !permReviewer.CanAccessAny(perm.AccessModeRead, unit.TypePullRequests) {
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Reviewer can't read",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if reviewer.ID == issue.PosterID && issue.OriginalAuthorID == 0 {
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "poster of pr can't be reviewer",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if canDoerChangeReviewRequests {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if doer.ID == issue.PosterID && issue.OriginalAuthorID == 0 && lastReview != nil && lastReview.Type != issues_model.ReviewTypeRequest {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Doer can't choose reviewer",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if canDoerChangeReviewRequests {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if lastReview != nil && lastReview.Type == issues_model.ReviewTypeRequest && lastReview.ReviewerID == doer.ID {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Doer can't remove reviewer",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// isValidTeamReviewRequest Check permission for ReviewRequest Team
|
||||||
|
func isValidTeamReviewRequest(ctx context.Context, reviewer *org_model.Team, doer *user_model.User, isAdd bool, issue *issues_model.Issue) error {
|
||||||
|
if doer.IsOrganization() {
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Organization can't be doer to add reviewer",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
canDoerChangeReviewRequests := CanDoerChangeReviewRequests(ctx, doer, issue.Repo, issue.PosterID)
|
||||||
|
|
||||||
|
if isAdd {
|
||||||
|
if issue.Repo.IsPrivate {
|
||||||
|
hasTeam := org_model.HasTeamRepo(ctx, reviewer.OrgID, reviewer.ID, issue.RepoID)
|
||||||
|
|
||||||
|
if !hasTeam {
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Reviewing team can't read repo",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if canDoerChangeReviewRequests {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Doer can't choose reviewer",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if canDoerChangeReviewRequests {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return issues_model.ErrNotValidReviewRequest{
|
||||||
|
Reason: "Doer can't remove reviewer",
|
||||||
|
UserID: doer.ID,
|
||||||
|
RepoID: issue.Repo.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TeamReviewRequest add or remove a review request from a team for this PR, and make comment for it.
|
||||||
|
func TeamReviewRequest(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, reviewer *org_model.Team, isAdd bool) (comment *issues_model.Comment, err error) {
|
||||||
|
err = isValidTeamReviewRequest(ctx, reviewer, doer, isAdd, issue)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if isAdd {
|
||||||
|
comment, err = issues_model.AddTeamReviewRequest(ctx, issue, reviewer, doer)
|
||||||
|
} else {
|
||||||
|
comment, err = issues_model.RemoveTeamReviewRequest(ctx, issue, reviewer, doer)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if comment == nil || !isAdd {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return comment, teamReviewRequestNotify(ctx, issue, doer, reviewer, isAdd, comment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func reviewRequestNotify(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, reviewNotifiers []*ReviewRequestNotifier) {
|
||||||
|
for _, reviewNotifier := range reviewNotifiers {
|
||||||
|
if reviewNotifier.Reviewer != nil {
|
||||||
|
notify_service.PullRequestReviewRequest(ctx, doer, issue, reviewNotifier.Reviewer, reviewNotifier.IsAdd, reviewNotifier.Comment)
|
||||||
|
} else if reviewNotifier.ReviewTeam != nil {
|
||||||
|
if err := teamReviewRequestNotify(ctx, issue, doer, reviewNotifier.ReviewTeam, reviewNotifier.IsAdd, reviewNotifier.Comment); err != nil {
|
||||||
|
log.Error("teamReviewRequestNotify: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// teamReviewRequestNotify notify all user in this team
|
||||||
|
func teamReviewRequestNotify(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, reviewer *org_model.Team, isAdd bool, comment *issues_model.Comment) error {
|
||||||
|
// notify all user in this team
|
||||||
|
if err := comment.LoadIssue(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
members, err := org_model.GetTeamMembers(ctx, &org_model.SearchMembersOptions{
|
||||||
|
TeamID: reviewer.ID,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, member := range members {
|
||||||
|
if member.ID == comment.Issue.PosterID {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
comment.AssigneeID = member.ID
|
||||||
|
notify_service.PullRequestReviewRequest(ctx, doer, issue, member, isAdd, comment)
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReviewRequestNotifier struct {
|
||||||
|
Comment *issues_model.Comment
|
||||||
|
IsAdd bool
|
||||||
|
Reviewer *user_model.User
|
||||||
|
ReviewTeam *org_model.Team
|
||||||
|
}
|
||||||
|
|
||||||
|
// CanDoerChangeReviewRequests returns if the doer can add/remove review requests of a PR
|
||||||
|
func CanDoerChangeReviewRequests(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, posterID int64) bool {
|
||||||
|
if repo.IsArchived {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// The poster of the PR can change the reviewers
|
||||||
|
if doer.ID == posterID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// The owner of the repo can change the reviewers
|
||||||
|
if doer.ID == repo.OwnerID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collaborators of the repo can change the reviewers
|
||||||
|
isCollaborator, err := repo_model.IsCollaborator(ctx, repo.ID, doer.ID)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("IsCollaborator: %v", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if isCollaborator {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the repo's owner is an organization, members of teams with read permission on pull requests can change reviewers
|
||||||
|
if repo.Owner.IsOrganization() {
|
||||||
|
teams, err := org_model.GetTeamsWithAccessToAnyRepoUnit(ctx, repo.OwnerID, repo.ID, perm.AccessModeRead, unit.TypePullRequests)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("GetTeamsWithAccessToRepo: %v", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, team := range teams {
|
||||||
|
if !team.UnitEnabled(ctx, unit.TypePullRequests) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
isMember, err := org_model.IsTeamMember(ctx, repo.OwnerID, team.ID, doer.ID)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("IsTeamMember: %v", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if isMember {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
notify_service.RegisterNotifier(&reviewRequestNotifer{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type reviewRequestNotifer struct {
|
||||||
|
notify_service.NullNotifier
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *reviewRequestNotifer) IssueChangeTitle(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldTitle string) {
|
||||||
|
if issue.IsPull && issues_model.HasWorkInProgressPrefix(oldTitle) && !issues_model.HasWorkInProgressPrefix(issue.Title) {
|
||||||
|
if err := issue.LoadPullRequest(ctx); err != nil {
|
||||||
|
log.Error("IssueChangeTitle: LoadPullRequest: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
reviewNotifiers, err := RequestCodeOwnersReview(ctx, issue.PullRequest)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("RequestCodeOwnersReview: %v", err)
|
||||||
|
} else {
|
||||||
|
reviewRequestNotify(ctx, issue, issue.Poster, reviewNotifiers)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue