Signed-off-by: Andrew Thornton <art27@cantab.net>tags/v1.21.12.1
| @@ -467,8 +467,8 @@ func InsertReviews(reviews []*Review) error { | |||||
| return sess.Commit() | return sess.Commit() | ||||
| } | } | ||||
| // AddRewiewRequest add a review request from one reviewer | |||||
| func AddRewiewRequest(issue *Issue, reviewer *User, doer *User) (comment *Comment, err error) { | |||||
| // AddReviewRequest add a review request from one reviewer | |||||
| func AddReviewRequest(issue *Issue, reviewer *User, doer *User) (comment *Comment, err error) { | |||||
| review, err := GetReviewerByIssueIDAndUserID(issue.ID, reviewer.ID) | review, err := GetReviewerByIssueIDAndUserID(issue.ID, reviewer.ID) | ||||
| if err != nil { | if err != nil { | ||||
| return | return | ||||
| @@ -534,8 +534,8 @@ func AddRewiewRequest(issue *Issue, reviewer *User, doer *User) (comment *Commen | |||||
| return comment, sess.Commit() | return comment, sess.Commit() | ||||
| } | } | ||||
| //RemoveRewiewRequest remove a review request from one reviewer | |||||
| func RemoveRewiewRequest(issue *Issue, reviewer *User, doer *User) (comment *Comment, err error) { | |||||
| //RemoveReviewRequest remove a review request from one reviewer | |||||
| func RemoveReviewRequest(issue *Issue, reviewer *User, doer *User) (comment *Comment, err error) { | |||||
| review, err := GetReviewerByIssueIDAndUserID(issue.ID, reviewer.ID) | review, err := GetReviewerByIssueIDAndUserID(issue.ID, reviewer.ID) | ||||
| if err != nil { | if err != nil { | ||||
| return | return | ||||
| @@ -24,7 +24,7 @@ type Notifier interface { | |||||
| NotifyIssueChangeStatus(*models.User, *models.Issue, *models.Comment, bool) | NotifyIssueChangeStatus(*models.User, *models.Issue, *models.Comment, bool) | ||||
| NotifyIssueChangeMilestone(doer *models.User, issue *models.Issue, oldMilestoneID int64) | NotifyIssueChangeMilestone(doer *models.User, issue *models.Issue, oldMilestoneID int64) | ||||
| NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) | NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) | ||||
| NotifyPullRewiewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) | |||||
| NotifyPullReviewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) | |||||
| NotifyIssueChangeContent(doer *models.User, issue *models.Issue, oldContent string) | NotifyIssueChangeContent(doer *models.User, issue *models.Issue, oldContent string) | ||||
| NotifyIssueClearLabels(doer *models.User, issue *models.Issue) | NotifyIssueClearLabels(doer *models.User, issue *models.Issue) | ||||
| NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) | NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) | ||||
| @@ -86,8 +86,8 @@ func (*NullNotifier) NotifyIssueChangeContent(doer *models.User, issue *models.I | |||||
| func (*NullNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) { | func (*NullNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) { | ||||
| } | } | ||||
| // NotifyPullRewiewRequest places a place holder function | |||||
| func (*NullNotifier) NotifyPullRewiewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { | |||||
| // NotifyPullReviewRequest places a place holder function | |||||
| func (*NullNotifier) NotifyPullReviewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { | |||||
| } | } | ||||
| // NotifyIssueClearLabels places a place holder function | // NotifyIssueClearLabels places a place holder function | ||||
| @@ -100,7 +100,7 @@ func (m *mailNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *model | |||||
| } | } | ||||
| } | } | ||||
| func (m *mailNotifier) NotifyPullRewiewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { | |||||
| func (m *mailNotifier) NotifyPullReviewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { | |||||
| if isRequest && doer.ID != reviewer.ID && reviewer.EmailNotifications() == models.EmailNotificationsEnabled { | if isRequest && doer.ID != reviewer.ID && reviewer.EmailNotifications() == models.EmailNotificationsEnabled { | ||||
| ct := fmt.Sprintf("Requested to review #%d.", issue.Index) | ct := fmt.Sprintf("Requested to review #%d.", issue.Index) | ||||
| mailer.SendIssueAssignedMail(issue, doer, ct, comment, []string{reviewer.Email}) | mailer.SendIssueAssignedMail(issue, doer, ct, comment, []string{reviewer.Email}) | ||||
| @@ -150,10 +150,10 @@ func NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee | |||||
| } | } | ||||
| } | } | ||||
| // NotifyPullRewiewRequest notifies Request Review change | |||||
| func NotifyPullRewiewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { | |||||
| // NotifyPullReviewRequest notifies Request Review change | |||||
| func NotifyPullReviewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { | |||||
| for _, notifier := range notifiers { | for _, notifier := range notifiers { | ||||
| notifier.NotifyPullRewiewRequest(doer, issue, reviewer, isRequest, comment) | |||||
| notifier.NotifyPullReviewRequest(doer, issue, reviewer, isRequest, comment) | |||||
| } | } | ||||
| } | } | ||||
| @@ -121,7 +121,7 @@ func (ns *notificationService) NotifyIssueChangeAssignee(doer *models.User, issu | |||||
| } | } | ||||
| } | } | ||||
| func (ns *notificationService) NotifyPullRewiewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { | |||||
| func (ns *notificationService) NotifyPullReviewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { | |||||
| if isRequest { | if isRequest { | ||||
| var opts = issueNotificationOpts{ | var opts = issueNotificationOpts{ | ||||
| IssueID: issue.ID, | IssueID: issue.ID, | ||||
| @@ -56,9 +56,9 @@ func ToggleAssignee(issue *models.Issue, doer *models.User, assigneeID int64) (r | |||||
| func ReviewRequest(issue *models.Issue, doer *models.User, reviewer *models.User, isAdd bool) (err error) { | func ReviewRequest(issue *models.Issue, doer *models.User, reviewer *models.User, isAdd bool) (err error) { | ||||
| var comment *models.Comment | var comment *models.Comment | ||||
| if isAdd { | if isAdd { | ||||
| comment, err = models.AddRewiewRequest(issue, reviewer, doer) | |||||
| comment, err = models.AddReviewRequest(issue, reviewer, doer) | |||||
| } else { | } else { | ||||
| comment, err = models.RemoveRewiewRequest(issue, reviewer, doer) | |||||
| comment, err = models.RemoveReviewRequest(issue, reviewer, doer) | |||||
| } | } | ||||
| if err != nil { | if err != nil { | ||||
| @@ -66,7 +66,7 @@ func ReviewRequest(issue *models.Issue, doer *models.User, reviewer *models.User | |||||
| } | } | ||||
| if comment != nil { | if comment != nil { | ||||
| notification.NotifyPullRewiewRequest(doer, issue, reviewer, isAdd, comment) | |||||
| notification.NotifyPullReviewRequest(doer, issue, reviewer, isAdd, comment) | |||||
| } | } | ||||
| return nil | return nil | ||||