Skip to content

Commit 06cd3e0

Browse files
6543sapk
authored andcommitted
[refactor] notify remove unused praram (#9804)
1 parent 11885da commit 06cd3e0

File tree

9 files changed

+10
-22
lines changed

9 files changed

+10
-22
lines changed

modules/notification/action/action.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"strings"
1212

1313
"code.gitea.io/gitea/models"
14-
"code.gitea.io/gitea/modules/git"
1514
"code.gitea.io/gitea/modules/log"
1615
"code.gitea.io/gitea/modules/notification/base"
1716
"code.gitea.io/gitea/modules/repository"
@@ -253,7 +252,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
253252
}
254253
}
255254

256-
func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) {
255+
func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
257256
if err := models.NotifyWatchers(&models.Action{
258257
ActUserID: doer.ID,
259258
ActUser: doer,

modules/notification/base/notifier.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package base
66

77
import (
88
"code.gitea.io/gitea/models"
9-
"code.gitea.io/gitea/modules/git"
109
"code.gitea.io/gitea/modules/repository"
1110
)
1211

@@ -32,7 +31,7 @@ type Notifier interface {
3231
addedLabels []*models.Label, removedLabels []*models.Label)
3332

3433
NotifyNewPullRequest(*models.PullRequest)
35-
NotifyMergePullRequest(*models.PullRequest, *models.User, *git.Repository)
34+
NotifyMergePullRequest(*models.PullRequest, *models.User)
3635
NotifyPullRequestSynchronized(doer *models.User, pr *models.PullRequest)
3736
NotifyPullRequestReview(*models.PullRequest, *models.Review, *models.Comment)
3837
NotifyPullRequestChangeTargetBranch(doer *models.User, pr *models.PullRequest, oldBranch string)

modules/notification/base/null.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package base
66

77
import (
88
"code.gitea.io/gitea/models"
9-
"code.gitea.io/gitea/modules/git"
109
"code.gitea.io/gitea/modules/repository"
1110
)
1211

@@ -44,7 +43,7 @@ func (*NullNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models.R
4443
}
4544

4645
// NotifyMergePullRequest places a place holder function
47-
func (*NullNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) {
46+
func (*NullNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
4847
}
4948

5049
// NotifyPullRequestSynchronized places a place holder function

modules/notification/mail/mail.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"fmt"
99

1010
"code.gitea.io/gitea/models"
11-
"code.gitea.io/gitea/modules/git"
1211
"code.gitea.io/gitea/modules/log"
1312
"code.gitea.io/gitea/modules/notification/base"
1413
"code.gitea.io/gitea/services/mailer"
@@ -101,7 +100,7 @@ func (m *mailNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *model
101100
}
102101
}
103102

104-
func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) {
103+
func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
105104
if err := pr.LoadIssue(); err != nil {
106105
log.Error("pr.LoadIssue: %v", err)
107106
return

modules/notification/notification.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package notification
66

77
import (
88
"code.gitea.io/gitea/models"
9-
"code.gitea.io/gitea/modules/git"
109
"code.gitea.io/gitea/modules/notification/action"
1110
"code.gitea.io/gitea/modules/notification/base"
1211
"code.gitea.io/gitea/modules/notification/indexer"
@@ -61,9 +60,9 @@ func NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComme
6160
}
6261

6362
// NotifyMergePullRequest notifies merge pull request to notifiers
64-
func NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repository) {
63+
func NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
6564
for _, notifier := range notifiers {
66-
notifier.NotifyMergePullRequest(pr, doer, baseGitRepo)
65+
notifier.NotifyMergePullRequest(pr, doer)
6766
}
6867
}
6968

modules/notification/ui/ui.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package ui
66

77
import (
88
"code.gitea.io/gitea/models"
9-
"code.gitea.io/gitea/modules/git"
109
"code.gitea.io/gitea/modules/log"
1110
"code.gitea.io/gitea/modules/notification/base"
1211
)
@@ -69,7 +68,7 @@ func (ns *notificationService) NotifyIssueChangeStatus(doer *models.User, issue
6968
}
7069
}
7170

72-
func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, gitRepo *git.Repository) {
71+
func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
7372
ns.issueQueue <- issueNotificationOpts{
7473
issueID: pr.Issue.ID,
7574
notificationAuthorID: doer.ID,

modules/notification/webhook/webhook.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Re
523523
}
524524
}
525525

526-
func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) {
526+
func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
527527
// Reload pull request information.
528528
if err := pr.LoadAttributes(); err != nil {
529529
log.Error("LoadAttributes: %v", err)

services/pull/check.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,7 @@ func manuallyMerged(pr *models.PullRequest) bool {
147147
return false
148148
}
149149

150-
baseGitRepo, err := git.OpenRepository(pr.BaseRepo.RepoPath())
151-
if err != nil {
152-
log.Error("OpenRepository[%s] : %v", pr.BaseRepo.RepoPath(), err)
153-
return false
154-
}
155-
156-
notification.NotifyMergePullRequest(pr, merger, baseGitRepo)
150+
notification.NotifyMergePullRequest(pr, merger)
157151

158152
log.Info("manuallyMerged[%d]: Marked as manually merged into %s/%s by commit id: %s", pr.ID, pr.BaseRepo.Name, pr.BaseBranch, commit.ID.String())
159153
return true

services/pull/merge.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor
350350
log.Error("setMerged [%d]: %v", pr.ID, err)
351351
}
352352

353-
notification.NotifyMergePullRequest(pr, doer, baseGitRepo)
353+
notification.NotifyMergePullRequest(pr, doer)
354354

355355
// Reset cached commit count
356356
cache.Remove(pr.Issue.Repo.GetCommitsCountCacheKey(pr.BaseBranch, true))

0 commit comments

Comments
 (0)