1
0
Fork 0
forked from forgejo/forgejo

Add notification interface and refactor UI notifications (#5085)

* add notification interface and refactor UI notifications

* add missing methods on notification interface and notifiy only issue status really changed

* implement NotifyPullRequestReview for ui notification
This commit is contained in:
Lunny Xiao 2018-10-18 19:23:05 +08:00 committed by GitHub
parent dd62ca7ba9
commit ea619b39b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 378 additions and 44 deletions

View file

@ -14,6 +14,7 @@ import (
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/util"
api "code.gitea.io/sdk/gitea"
@ -270,6 +271,8 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
return
}
notification.NotifyNewPullRequest(pr)
log.Trace("Pull request created: %d/%d", repo.ID, prIssue.ID)
ctx.JSON(201, pr.APIFormat())
}
@ -386,6 +389,8 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
ctx.Error(500, "ChangeStatus", err)
return
}
notification.NotifyIssueChangeStatus(ctx.User, issue, api.StateClosed == api.StateType(*form.State))
}
// Refetch from database