]> source.dussan.org Git - gitea.git/commitdiff
[refactor] notify remove unused praram (#9804)
author6543 <6543@obermui.de>
Thu, 16 Jan 2020 16:24:20 +0000 (17:24 +0100)
committerAntoine GIRARD <sapk@users.noreply.github.com>
Thu, 16 Jan 2020 16:24:20 +0000 (17:24 +0100)
modules/notification/action/action.go
modules/notification/base/notifier.go
modules/notification/base/null.go
modules/notification/mail/mail.go
modules/notification/notification.go
modules/notification/ui/ui.go
modules/notification/webhook/webhook.go
services/pull/check.go
services/pull/merge.go

index 74e661c4f9de3be9a8993ac80dbc0568628d5cce..9956940f30b22d75c05e2f58d56305a09f32a6d8 100644 (file)
@@ -11,7 +11,6 @@ import (
        "strings"
 
        "code.gitea.io/gitea/models"
-       "code.gitea.io/gitea/modules/git"
        "code.gitea.io/gitea/modules/log"
        "code.gitea.io/gitea/modules/notification/base"
        "code.gitea.io/gitea/modules/repository"
@@ -253,7 +252,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
        }
 }
 
-func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) {
+func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
        if err := models.NotifyWatchers(&models.Action{
                ActUserID: doer.ID,
                ActUser:   doer,
index 12fde1737d223922c045b1c5b141f88f1b309b53..1c607ded3b2506a9a43e840622ec823b1b2be914 100644 (file)
@@ -6,7 +6,6 @@ package base
 
 import (
        "code.gitea.io/gitea/models"
-       "code.gitea.io/gitea/modules/git"
        "code.gitea.io/gitea/modules/repository"
 )
 
@@ -32,7 +31,7 @@ type Notifier interface {
                addedLabels []*models.Label, removedLabels []*models.Label)
 
        NotifyNewPullRequest(*models.PullRequest)
-       NotifyMergePullRequest(*models.PullRequest, *models.User, *git.Repository)
+       NotifyMergePullRequest(*models.PullRequest, *models.User)
        NotifyPullRequestSynchronized(doer *models.User, pr *models.PullRequest)
        NotifyPullRequestReview(*models.PullRequest, *models.Review, *models.Comment)
        NotifyPullRequestChangeTargetBranch(doer *models.User, pr *models.PullRequest, oldBranch string)
index 1f90f6519d3a04e582afd8980520ea6b8539256a..f6c423b4694c433e6420fb42cb049cc7b9a38064 100644 (file)
@@ -6,7 +6,6 @@ package base
 
 import (
        "code.gitea.io/gitea/models"
-       "code.gitea.io/gitea/modules/git"
        "code.gitea.io/gitea/modules/repository"
 )
 
@@ -44,7 +43,7 @@ func (*NullNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models.R
 }
 
 // NotifyMergePullRequest places a place holder function
-func (*NullNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) {
+func (*NullNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
 }
 
 // NotifyPullRequestSynchronized places a place holder function
index 6cc6fda14bbb69ec26880318293cc70c4e5f4991..ec7d9d617e572991d09af489dfb1068a48d52c19 100644 (file)
@@ -8,7 +8,6 @@ import (
        "fmt"
 
        "code.gitea.io/gitea/models"
-       "code.gitea.io/gitea/modules/git"
        "code.gitea.io/gitea/modules/log"
        "code.gitea.io/gitea/modules/notification/base"
        "code.gitea.io/gitea/services/mailer"
@@ -101,7 +100,7 @@ func (m *mailNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *model
        }
 }
 
-func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) {
+func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
        if err := pr.LoadIssue(); err != nil {
                log.Error("pr.LoadIssue: %v", err)
                return
index ed7204c9e0ec04c7430bbf4d1ca98665a79e9a9b..8c5d7d60358e2d7fdd2a4b7ae7b8b772026b5616 100644 (file)
@@ -6,7 +6,6 @@ package notification
 
 import (
        "code.gitea.io/gitea/models"
-       "code.gitea.io/gitea/modules/git"
        "code.gitea.io/gitea/modules/notification/action"
        "code.gitea.io/gitea/modules/notification/base"
        "code.gitea.io/gitea/modules/notification/indexer"
@@ -61,9 +60,9 @@ func NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComme
 }
 
 // NotifyMergePullRequest notifies merge pull request to notifiers
-func NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repository) {
+func NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
        for _, notifier := range notifiers {
-               notifier.NotifyMergePullRequest(pr, doer, baseGitRepo)
+               notifier.NotifyMergePullRequest(pr, doer)
        }
 }
 
index f58ebce6d7a69abe4131527a7581a59d5a214f2e..a8c904e22cec9b47854ca17abda641b9d0679c9f 100644 (file)
@@ -6,7 +6,6 @@ package ui
 
 import (
        "code.gitea.io/gitea/models"
-       "code.gitea.io/gitea/modules/git"
        "code.gitea.io/gitea/modules/log"
        "code.gitea.io/gitea/modules/notification/base"
 )
@@ -69,7 +68,7 @@ func (ns *notificationService) NotifyIssueChangeStatus(doer *models.User, issue
        }
 }
 
-func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, gitRepo *git.Repository) {
+func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
        ns.issueQueue <- issueNotificationOpts{
                issueID:              pr.Issue.ID,
                notificationAuthorID: doer.ID,
index 3f993df88e83df4fc46fdacf3ad97d133e5b3fbe..df41078fb08cdab8fe96dec05564f4858117574e 100644 (file)
@@ -523,7 +523,7 @@ func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Re
        }
 }
 
-func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) {
+func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
        // Reload pull request information.
        if err := pr.LoadAttributes(); err != nil {
                log.Error("LoadAttributes: %v", err)
index c5d8a585cb3196c4abff9021c06e5cbf877583ad..5d380b4609de30f959074ab5e367d9a0530fdb2b 100644 (file)
@@ -147,13 +147,7 @@ func manuallyMerged(pr *models.PullRequest) bool {
                        return false
                }
 
-               baseGitRepo, err := git.OpenRepository(pr.BaseRepo.RepoPath())
-               if err != nil {
-                       log.Error("OpenRepository[%s] : %v", pr.BaseRepo.RepoPath(), err)
-                       return false
-               }
-
-               notification.NotifyMergePullRequest(pr, merger, baseGitRepo)
+               notification.NotifyMergePullRequest(pr, merger)
 
                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())
                return true
index f6f0abe8362c834fa021833fa7460803f955ef2e..5e077f6dc02430792f9bb57e2a07bee8e5d0ca68 100644 (file)
@@ -350,7 +350,7 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor
                log.Error("setMerged [%d]: %v", pr.ID, err)
        }
 
-       notification.NotifyMergePullRequest(pr, doer, baseGitRepo)
+       notification.NotifyMergePullRequest(pr, doer)
 
        // Reset cached commit count
        cache.Remove(pr.Issue.Repo.GetCommitsCountCacheKey(pr.BaseBranch, true))