Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 2, 2019
1 parent 3ff9d59 commit e151ead
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
9 changes: 3 additions & 6 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,7 @@ func (issue *Issue) ChangeTitle(doer *User, oldTitle string) (err error) {
OldTitle: oldTitle,
NewTitle: issue.Title,
}
_, err = createCommentWithNoAction(sess, opts)
if err != nil {
if _, err = createCommentWithNoAction(sess, opts); err != nil {
return fmt.Errorf("createComment: %v", err)
}
if err = issue.addCrossReferences(sess, doer, true); err != nil {
Expand Down Expand Up @@ -750,8 +749,7 @@ func AddDeletePRBranchComment(doer *User, repo *Repository, issueID int64, branc
Issue: issue,
CommitSHA: branchName,
}
_, err = createCommentWithNoAction(sess, opts)
if err != nil {
if _, err = createCommentWithNoAction(sess, opts); err != nil {
return err
}

Expand Down Expand Up @@ -893,8 +891,7 @@ func newIssue(e *xorm.Session, doer *User, opts NewIssueOptions) (err error) {
OldMilestoneID: 0,
MilestoneID: opts.Issue.MilestoneID,
}
_, err = createCommentWithNoAction(e, opts)
if err != nil {
if _, err = createCommentWithNoAction(e, opts); err != nil {
return err
}
}
Expand Down
7 changes: 1 addition & 6 deletions models/issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,7 @@ func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dep
Issue: issue,
DependentIssueID: dependentIssue.ID,
}
_, err = createCommentWithNoAction(e, opts)
if err != nil {
if _, err = createCommentWithNoAction(e, opts); err != nil {
return
}

Expand All @@ -712,10 +711,6 @@ func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dep
DependentIssueID: issue.ID,
}
_, err = createCommentWithNoAction(e, opts)
if err != nil {
return
}

return
}

Expand Down
6 changes: 2 additions & 4 deletions models/issue_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ func newIssueLabel(e *xorm.Session, issue *Issue, label *Label, doer *User) (err
Label: label,
Content: "1",
}
_, err = createCommentWithNoAction(e, opts)
if err != nil {
if _, err = createCommentWithNoAction(e, opts); err != nil {
return err
}

Expand Down Expand Up @@ -491,8 +490,7 @@ func deleteIssueLabel(e *xorm.Session, issue *Issue, label *Label, doer *User) (
Issue: issue,
Label: label,
}
_, err = createCommentWithNoAction(e, opts)
if err != nil {
if _, err = createCommentWithNoAction(e, opts); err != nil {
return err
}

Expand Down
3 changes: 1 addition & 2 deletions models/issue_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ func updateIssueLock(opts *IssueLockOptions, lock bool) error {
Type: commentType,
Content: opts.Reason,
}
_, err := createCommentWithNoAction(sess, opt)
if err != nil {
if _, err := createCommentWithNoAction(sess, opt); err != nil {
return err
}

Expand Down
3 changes: 1 addition & 2 deletions models/issue_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,7 @@ func changeMilestoneAssign(e *xorm.Session, doer *User, issue *Issue, oldMilesto
OldMilestoneID: oldMilestoneID,
MilestoneID: issue.MilestoneID,
}
_, err := createCommentWithNoAction(e, opts)
if err != nil {
if _, err := createCommentWithNoAction(e, opts); err != nil {
return err
}
}
Expand Down

0 comments on commit e151ead

Please sign in to comment.