Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notification interface and refactor UI notifications #5085

Merged
merged 3 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
implement NotifyPullRequestReview for ui notification
  • Loading branch information
lunny committed Oct 18, 2018
commit ef91809e41011d39a98a593f1f0af2fb9b13c144
4 changes: 4 additions & 0 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ func (issue *Issue) GetPullRequest() (pr *PullRequest, err error) {
}

pr, err = getPullRequestByIssueID(x, issue.ID)
if err != nil {
return nil, err
}
pr.Issue = issue
return
}

Expand Down
2 changes: 2 additions & 0 deletions models/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ func getCurrentReview(e Engine, reviewer *User, issue *Issue) (*Review, error) {
if len(reviews) == 0 {
return nil, ErrReviewNotExist{}
}
reviews[0].Reviewer = reviewer
reviews[0].Issue = issue
return reviews[0], nil
}

Expand Down
6 changes: 5 additions & 1 deletion modules/notification/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest) {
}
}

func (ns *notificationService) NotifyPullRequestReview(*models.PullRequest, *models.Review, *models.Comment) {
func (ns *notificationService) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, c *models.Comment) {
ns.issueQueue <- issueNotificationOpts{
pr.Issue,
r.Reviewer.ID,
}
}
jonasfranz marked this conversation as resolved.
Show resolved Hide resolved

func (ns *notificationService) NotifyUpdateComment(doer *models.User, c *models.Comment, oldContent string) {
Expand Down
8 changes: 8 additions & 0 deletions routers/repo/pull_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,13 @@ func SubmitReview(ctx *context.Context, form auth.SubmitReviewForm) {
ctx.ServerError("Publish", err)
return
}