From a5acec329e2ca61044f1e1d96858624f2c4a46ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=88=E7=AC=91=E9=A3=8E=E7=94=9F=E9=97=B4?= Date: Wed, 31 May 2023 15:54:46 +0800 Subject: [PATCH] Rename NotifyPullReviewRequest to NotifyPullRequestReviewRequest (#24988) after #24481 To keep consistent, maybe pull_request_review_request is better. ## what my pull request does Rename NotifyPullReviewRequest to NotifyPullRequestReviewRequest. image --- modules/notification/base/notifier.go | 2 +- modules/notification/base/null.go | 4 ++-- modules/notification/mail/mail.go | 2 +- modules/notification/notification.go | 6 +++--- modules/notification/ui/ui.go | 2 +- services/issue/assignee.go | 4 ++-- services/webhook/notifier.go | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/notification/base/notifier.go b/modules/notification/base/notifier.go index 87eae3f41..e1762bb1e 100644 --- a/modules/notification/base/notifier.go +++ b/modules/notification/base/notifier.go @@ -28,7 +28,7 @@ type Notifier interface { NotifyDeleteIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) NotifyIssueChangeMilestone(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64) NotifyIssueChangeAssignee(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment) - NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) + NotifyPullRequestReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) NotifyIssueChangeContent(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldContent string) NotifyIssueClearLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) NotifyIssueChangeTitle(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldTitle string) diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go index 187c36bee..338790b35 100644 --- a/modules/notification/base/null.go +++ b/modules/notification/base/null.go @@ -120,8 +120,8 @@ func (*NullNotifier) NotifyIssueChangeContent(ctx context.Context, doer *user_mo func (*NullNotifier) NotifyIssueChangeAssignee(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment) { } -// NotifyPullReviewRequest places a place holder function -func (*NullNotifier) NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { +// NotifyPullRequestReviewRequest places a place holder function +func (*NullNotifier) NotifyPullRequestReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { } // NotifyIssueClearLabels places a place holder function diff --git a/modules/notification/mail/mail.go b/modules/notification/mail/mail.go index 7e54df44c..a5fed51eb 100644 --- a/modules/notification/mail/mail.go +++ b/modules/notification/mail/mail.go @@ -123,7 +123,7 @@ func (m *mailNotifier) NotifyIssueChangeAssignee(ctx context.Context, doer *user } } -func (m *mailNotifier) NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { +func (m *mailNotifier) NotifyPullRequestReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { if isRequest && doer.ID != reviewer.ID && reviewer.EmailNotifications() != user_model.EmailNotificationsDisabled { ct := fmt.Sprintf("Requested to review %s.", issue.HTMLURL()) if err := mailer.SendIssueAssignedMail(ctx, issue, doer, ct, comment, []*user_model.User{reviewer}); err != nil { diff --git a/modules/notification/notification.go b/modules/notification/notification.go index 72dd1c99e..6153c9e3d 100644 --- a/modules/notification/notification.go +++ b/modules/notification/notification.go @@ -230,10 +230,10 @@ func NotifyIssueChangeAssignee(ctx context.Context, doer *user_model.User, issue } } -// NotifyPullReviewRequest notifies Request Review change -func NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { +// NotifyPullRequestReviewRequest notifies Request Review change +func NotifyPullRequestReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { for _, notifier := range notifiers { - notifier.NotifyPullReviewRequest(ctx, doer, issue, reviewer, isRequest, comment) + notifier.NotifyPullRequestReviewRequest(ctx, doer, issue, reviewer, isRequest, comment) } } diff --git a/modules/notification/ui/ui.go b/modules/notification/ui/ui.go index 6c5f22c12..2ca1a7700 100644 --- a/modules/notification/ui/ui.go +++ b/modules/notification/ui/ui.go @@ -229,7 +229,7 @@ func (ns *notificationService) NotifyIssueChangeAssignee(ctx context.Context, do } } -func (ns *notificationService) NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { +func (ns *notificationService) NotifyPullRequestReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { if isRequest { opts := issueNotificationOpts{ IssueID: issue.ID, diff --git a/services/issue/assignee.go b/services/issue/assignee.go index 4d0224d4b..943a761e2 100644 --- a/services/issue/assignee.go +++ b/services/issue/assignee.go @@ -73,7 +73,7 @@ func ReviewRequest(ctx context.Context, issue *issues_model.Issue, doer, reviewe } if comment != nil { - notification.NotifyPullReviewRequest(ctx, doer, issue, reviewer, isAdd, comment) + notification.NotifyPullRequestReviewRequest(ctx, doer, issue, reviewer, isAdd, comment) } return comment, err @@ -260,7 +260,7 @@ func TeamReviewRequest(ctx context.Context, issue *issues_model.Issue, doer *use continue } comment.AssigneeID = member.ID - notification.NotifyPullReviewRequest(ctx, doer, issue, member, isAdd, comment) + notification.NotifyPullRequestReviewRequest(ctx, doer, issue, member, isAdd, comment) } return comment, err diff --git a/services/webhook/notifier.go b/services/webhook/notifier.go index e10c83e02..e6d1875b2 100644 --- a/services/webhook/notifier.go +++ b/services/webhook/notifier.go @@ -719,9 +719,9 @@ func (m *webhookNotifier) NotifyPullRequestReview(ctx context.Context, pr *issue } } -func (m *webhookNotifier) NotifyPullReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { +func (m *webhookNotifier) NotifyPullRequestReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) { if !issue.IsPull { - log.Warn("NotifyPullReviewRequest: issue is not a pull request: %v", issue.ID) + log.Warn("NotifyPullRequestReviewRequest: issue is not a pull request: %v", issue.ID) return } mode, _ := access_model.AccessLevelUnit(ctx, doer, issue.Repo, unit.TypePullRequests)