Skip to content

Commit 3e0dcea

Browse files
splitt3rCalK16
authored andcommitted
Check if Pull + run linter
1 parent 45b8a96 commit 3e0dcea

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

routers/web/repo/issue.go

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,28 +1219,30 @@ func ValidateRepoMetas(ctx *context.Context, form forms.CreateIssueForm, isPull
12191219

12201220
// Check reviewers
12211221
var reviewerIDs []int64
1222-
if len(form.ReviewerIDs) > 0 {
1223-
reviewerIDs, err = base.StringsToInt64s(strings.Split(form.ReviewerIDs, ","))
1224-
if err != nil {
1225-
return nil, nil, nil, 0, 0
1226-
}
1222+
if isPull {
1223+
if len(form.ReviewerIDs) > 0 {
1224+
reviewerIDs, err = base.StringsToInt64s(strings.Split(form.ReviewerIDs, ","))
1225+
if err != nil {
1226+
return nil, nil, nil, 0, 0
1227+
}
12271228

1228-
// Check if the passed reviewers (user/team) actually exist
1229-
for _, rID := range reviewerIDs {
1230-
// negative reviewIDs represent team requests
1231-
if rID < 0 {
1232-
_, err := organization.GetTeamByID(ctx, -rID)
1229+
// Check if the passed reviewers (user/team) actually exist
1230+
for _, rID := range reviewerIDs {
1231+
// negative reviewIDs represent team requests
1232+
if rID < 0 {
1233+
_, err := organization.GetTeamByID(ctx, -rID)
1234+
if err != nil {
1235+
ctx.ServerError("GetTeamByID", err)
1236+
return nil, nil, nil, 0, 0
1237+
}
1238+
continue
1239+
}
1240+
1241+
_, err := user_model.GetUserByID(ctx, rID)
12331242
if err != nil {
1234-
ctx.ServerError("GetTeamByID", err)
1243+
ctx.ServerError("GetUserByID", err)
12351244
return nil, nil, nil, 0, 0
12361245
}
1237-
continue
1238-
}
1239-
1240-
_, err := user_model.GetUserByID(ctx, rID)
1241-
if err != nil {
1242-
ctx.ServerError("GetUserByID", err)
1243-
return nil, nil, nil, 0, 0
12441246
}
12451247
}
12461248
}

services/pull/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func getPullWorkingLockKey(prID int64) string {
4343
}
4444

4545
// NewPullRequest creates new pull request with labels for repository.
46-
func NewPullRequest(ctx context.Context, repo *repo_model.Repository, issue *issues_model.Issue, labelIDs []int64, uuids []string, pr *issues_model.PullRequest, assigneeIDs []int64, reviewerIDs []int64) error {
46+
func NewPullRequest(ctx context.Context, repo *repo_model.Repository, issue *issues_model.Issue, labelIDs []int64, uuids []string, pr *issues_model.PullRequest, assigneeIDs, reviewerIDs []int64) error {
4747
if err := issue.LoadPoster(ctx); err != nil {
4848
return err
4949
}

0 commit comments

Comments
 (0)