diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-10-30 18:02:46 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-10-30 12:02:46 +0200 |
commit | ac6accef092ea5a983a4a8ee35282246fc3c6fc5 (patch) | |
tree | 2a44c0198dd6e2f9c06eaa49603fd3d28793e1fa /routers | |
parent | f694bb45d79dcc093bc6332eabb3af063bc6b088 (diff) | |
download | gitea-ac6accef092ea5a983a4a8ee35282246fc3c6fc5.tar.gz gitea-ac6accef092ea5a983a4a8ee35282246fc3c6fc5.zip |
Move webhook codes from service to webhook notification (#8712)
* Move webhook codes from service to webhook notification
* move deletecomment webhook to notifications
* fix notification
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/issue_comment.go | 7 | ||||
-rw-r--r-- | routers/repo/issue.go | 8 |
2 files changed, 1 insertions, 14 deletions
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go index 60796031a5..3a5f6d2447 100644 --- a/routers/api/v1/repo/issue_comment.go +++ b/routers/api/v1/repo/issue_comment.go @@ -10,7 +10,6 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" - "code.gitea.io/gitea/modules/notification" api "code.gitea.io/gitea/modules/structs" comment_service "code.gitea.io/gitea/services/comments" ) @@ -196,8 +195,6 @@ func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOpti return } - notification.NotifyCreateIssueComment(ctx.User, ctx.Repo.Repository, issue, comment) - ctx.JSON(201, comment.APIFormat()) } @@ -305,8 +302,6 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption) return } - notification.NotifyUpdateComment(ctx.User, comment, oldContent) - ctx.JSON(200, comment.APIFormat()) } @@ -396,7 +391,5 @@ func deleteIssueComment(ctx *context.APIContext) { return } - notification.NotifyDeleteComment(ctx.User, comment) - ctx.Status(204) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index ac405a1c29..04c718d5b9 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -1324,8 +1324,6 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) { return } - notification.NotifyCreateIssueComment(ctx.User, ctx.Repo.Repository, issue, comment) - log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID) } @@ -1375,8 +1373,6 @@ func UpdateCommentContent(ctx *context.Context) { ctx.ServerError("UpdateAttachments", err) } - notification.NotifyUpdateComment(ctx.User, comment, oldContent) - ctx.JSON(200, map[string]interface{}{ "content": string(markdown.Render([]byte(comment.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())), "attachments": attachmentsHTML(ctx, comment.Attachments), @@ -1404,13 +1400,11 @@ func DeleteComment(ctx *context.Context) { return } - if err = models.DeleteComment(comment, ctx.User); err != nil { + if err = comment_service.DeleteComment(comment, ctx.User); err != nil { ctx.ServerError("DeleteCommentByID", err) return } - notification.NotifyDeleteComment(ctx.User, comment) - ctx.Status(200) } |