mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-17 02:05:58 +08:00
新增:评论丰富更新删除操作,issue事件粒度更细
This commit is contained in:
@@ -2,14 +2,16 @@ class Webhook::IssueCommentClient
|
||||
|
||||
include Webhook::Client
|
||||
|
||||
attr_accessor :webhook, :issue, :journal, :sender, :event
|
||||
attr_accessor :webhook, :issue, :journal, :sender, :event, :action_type, :comment_json
|
||||
|
||||
def initialize(webhook, issue, journal, sender, event)
|
||||
def initialize(webhook, issue, journal, sender, event, action_type, comment_json={})
|
||||
@webhook = webhook
|
||||
@issue = issue
|
||||
@journal = journal
|
||||
@sender = sender
|
||||
@event = event
|
||||
@action_type = action_type
|
||||
@comment_json = comment_json
|
||||
|
||||
# 构建client参数
|
||||
super({
|
||||
@@ -25,13 +27,19 @@ class Webhook::IssueCommentClient
|
||||
private
|
||||
|
||||
def payload_content
|
||||
{
|
||||
"action": "created",
|
||||
payload_content = {
|
||||
"action": @action_type,
|
||||
"issue": JSON.parse(@issue.to_builder.target!),
|
||||
"journal": JSON.parse(@journal.to_builder.target!),
|
||||
"journal": @journal.present? ? JSON.parse(@journal.to_builder.target!) : @comment_json,
|
||||
"project": JSON.parse(@issue.project.to_builder.target!),
|
||||
"sender": JSON.parse(@sender.to_builder.target!),
|
||||
"is_pull": false
|
||||
}
|
||||
|
||||
payload_content.merge!({
|
||||
"changes": @comment_json,
|
||||
}) if @action_type == "edited"
|
||||
|
||||
payload_content
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user