Skip to content

Commit d8dec2c

Browse files
committed
typo and function refactor
1 parent 19a5c66 commit d8dec2c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

models/action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,13 +670,13 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
670670

671671
for _, issue := range issues {
672672
if isForcePush {
673-
if err := ClearPullPushComent(issue); err != nil {
673+
if err := ClearPullPushComment(issue); err != nil {
674674
return fmt.Errorf("ClearPullPushComent: %v", err)
675675
}
676676
}
677677

678678
for _, c := range opts.Commits.Commits {
679-
if err := CreatePullPushComment(pusher, issue.Repo, issue, c.Message, c.Sha1, issue.Repo.FullName()); err != nil {
679+
if err := CreatePullPushComment(pusher, issue.Repo, issue, c); err != nil {
680680
return fmt.Errorf("CreatePullPushComment: %v", err)
681681
}
682682
}

models/issue_comment.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,8 @@ func CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commi
600600
return err
601601
}
602602

603-
// ClearPullPushComent clear all the push commit on issue since fore push
604-
func ClearPullPushComent(issue *Issue) error {
603+
// ClearPullPushComment clear all the push commit on issue since fore push
604+
func ClearPullPushComment(issue *Issue) error {
605605
_, err := x.Delete(&Comment{
606606
Type: CommentTypePullPushCommit,
607607
IssueID: issue.ID,
@@ -610,16 +610,16 @@ func ClearPullPushComent(issue *Issue) error {
610610
}
611611

612612
// CreatePullPushComment creates a commit when push commit to a pull request.
613-
func CreatePullPushComment(doer *User, repo *Repository, issue *Issue, content, commitSHA, repoFullName string) error {
614-
if len(commitSHA) == 0 {
613+
func CreatePullPushComment(doer *User, repo *Repository, issue *Issue, commit *PushCommit) error {
614+
if len(commit.Sha1) == 0 {
615615
return fmt.Errorf("cannot create reference with empty commit SHA")
616616
}
617617

618618
// Check if same reference from same commit has already existed.
619619
has, err := x.Get(&Comment{
620620
Type: CommentTypePullPushCommit,
621621
IssueID: issue.ID,
622-
CommitSHA: commitSHA,
622+
CommitSHA: commit.Sha1,
623623
})
624624
if err != nil {
625625
return fmt.Errorf("check pull push comment: %v", err)
@@ -631,9 +631,9 @@ func CreatePullPushComment(doer *User, repo *Repository, issue *Issue, content,
631631
Doer: doer,
632632
Repo: repo,
633633
Issue: issue,
634-
CommitSHA: commitSHA,
635-
Content: content,
636-
RepoFullName: repoFullName,
634+
CommitSHA: commit.Sha1,
635+
Content: commit.Message,
636+
RepoFullName: repo.FullName(),
637637
})
638638
}
639639
return err

0 commit comments

Comments
 (0)