1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-06 02:15:20 +02:00

Move more issue assignee code from models to issue service (#8690)

* Move more issue assignee code from models to issue service

* fix test
This commit is contained in:
Lunny Xiao 2019-10-28 10:11:50 +08:00 committed by GitHub
parent 018b0e8180
commit 495d5e4329
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 193 additions and 129 deletions

View file

@ -1050,14 +1050,11 @@ func UpdateIssueTitle(ctx *context.Context) {
return
}
oldTitle := issue.Title
if err := issue_service.ChangeTitle(issue, ctx.User, title); err != nil {
ctx.ServerError("ChangeTitle", err)
return
}
notification.NotifyIssueChangeTitle(ctx.User, issue, oldTitle)
ctx.JSON(200, map[string]interface{}{
"title": issue.Title,
})
@ -1130,7 +1127,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
for _, issue := range issues {
switch action {
case "clear":
if err := models.DeleteNotPassedAssignee(issue, ctx.User, []*models.User{}); err != nil {
if err := issue_service.DeleteNotPassedAssignee(issue, ctx.User, []*models.User{}); err != nil {
ctx.ServerError("ClearAssignees", err)
return
}
@ -1151,7 +1148,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
return
}
removed, comment, err := issue.ToggleAssignee(ctx.User, assigneeID)
removed, comment, err := issue_service.ToggleAssignee(issue, ctx.User, assigneeID)
if err != nil {
ctx.ServerError("ToggleAssignee", err)
return