Merge pull request 'webhook自定义事件' (#43) from feature_custom_webhook into develop

This commit is contained in:
2023-04-14 11:39:47 +08:00
28 changed files with 700 additions and 55 deletions

View File

@@ -27,6 +27,7 @@ class Api::V1::Issues::JournalsController < Api::V1::BaseController
end
def destroy
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueComment', @issue&.id, current_user.id, @journal.id, 'deleted', JSON.parse(@journal.to_builder.target!))
if @journal.destroy!
render_ok
else

View File

@@ -46,6 +46,7 @@ class JournalsController < ApplicationController
end
Rails.logger.info "[ATME] maybe to at such users: #{@atme_receivers.pluck(:login)}"
AtmeService.call(current_user, @atme_receivers, journal) if @atme_receivers.size > 0
TouchWebhookJob.set(wait: 5.seconds).perform_later('PullRequestComment', @issue&.id, current_user.id, journal.id, 'created', {})
# @issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "journal")
render :json => { status: 0, message: "评论成功", id: journal.id}
# normal_status(0, "评论成功")
@@ -61,6 +62,7 @@ class JournalsController < ApplicationController
def destroy
if @journal.destroy #如果有子评论,子评论删除吗?
TouchWebhookJob.set(wait: 5.seconds).perform_later('PullRequestComment', @issue&.id, current_user.id, @journal.id, 'deleted', JSON.parse(@journal.to_builder.target!))
Journal.children_journals(@journal.id).destroy_all
normal_status(0, "评论删除成功")
else