fix issue webhook error
This commit is contained in:
parent
a69e4e5014
commit
1e7cffd716
3
Gemfile
3
Gemfile
|
@ -70,6 +70,9 @@ group :development do
|
||||||
gem 'web-console', '>= 3.3.0'
|
gem 'web-console', '>= 3.3.0'
|
||||||
gem 'listen', '>= 3.0.5', '< 3.2'
|
gem 'listen', '>= 3.0.5', '< 3.2'
|
||||||
gem 'spring'
|
gem 'spring'
|
||||||
|
gem 'pry-rails'
|
||||||
|
gem 'pry-remote'
|
||||||
|
gem 'byebug', platforms: [:mri,:mingw,:x64_mingw]
|
||||||
gem 'spring-watcher-listen', '~> 2.0.0'
|
gem 'spring-watcher-listen', '~> 2.0.0'
|
||||||
gem "annotate", "~> 2.6.0"
|
gem "annotate", "~> 2.6.0"
|
||||||
end
|
end
|
||||||
|
|
52
Gemfile.lock
52
Gemfile.lock
|
@ -1,5 +1,5 @@
|
||||||
GEM
|
GEM
|
||||||
remote: https://gems.ruby-china.com/
|
remote: https://mirrors.cloud.tencent.com/rubygems/
|
||||||
specs:
|
specs:
|
||||||
aasm (5.0.6)
|
aasm (5.0.6)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
|
@ -84,6 +84,7 @@ GEM
|
||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
bulk_insert (1.7.0)
|
bulk_insert (1.7.0)
|
||||||
activerecord (>= 3.2.0)
|
activerecord (>= 3.2.0)
|
||||||
|
byebug (11.1.3)
|
||||||
capybara (3.15.1)
|
capybara (3.15.1)
|
||||||
addressable
|
addressable
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
|
@ -99,6 +100,7 @@ GEM
|
||||||
archive-zip (~> 0.10)
|
archive-zip (~> 0.10)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
chunky_png (1.3.11)
|
chunky_png (1.3.11)
|
||||||
|
coderay (1.1.3)
|
||||||
concurrent-ruby (1.1.6)
|
concurrent-ruby (1.1.6)
|
||||||
connection_pool (2.2.2)
|
connection_pool (2.2.2)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
|
@ -106,6 +108,8 @@ GEM
|
||||||
activerecord (>= 3.1.0, < 7)
|
activerecord (>= 3.1.0, < 7)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
diffy (3.3.0)
|
diffy (3.3.0)
|
||||||
|
domain_name (0.5.20190701)
|
||||||
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
doorkeeper (5.5.1)
|
doorkeeper (5.5.1)
|
||||||
railties (>= 5)
|
railties (>= 5)
|
||||||
doorkeeper-jwt (0.4.1)
|
doorkeeper-jwt (0.4.1)
|
||||||
|
@ -133,6 +137,8 @@ GEM
|
||||||
fugit (1.4.1)
|
fugit (1.4.1)
|
||||||
et-orbi (~> 1.1, >= 1.1.8)
|
et-orbi (~> 1.1, >= 1.1.8)
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
|
gitea-client (1.4.1)
|
||||||
|
rest-client (~> 2.1.0)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
grape-entity (0.7.1)
|
grape-entity (0.7.1)
|
||||||
|
@ -143,6 +149,9 @@ GEM
|
||||||
harmonious_dictionary (0.0.1)
|
harmonious_dictionary (0.0.1)
|
||||||
hashie (3.6.0)
|
hashie (3.6.0)
|
||||||
htmlentities (4.3.4)
|
htmlentities (4.3.4)
|
||||||
|
http-accept (1.7.0)
|
||||||
|
http-cookie (1.0.5)
|
||||||
|
domain_name (~> 0.5)
|
||||||
i18n (1.8.2)
|
i18n (1.8.2)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
io-like (0.3.1)
|
io-like (0.3.1)
|
||||||
|
@ -180,6 +189,9 @@ GEM
|
||||||
mimemagic (~> 0.3.2)
|
mimemagic (~> 0.3.2)
|
||||||
maruku (0.7.3)
|
maruku (0.7.3)
|
||||||
method_source (0.9.2)
|
method_source (0.9.2)
|
||||||
|
mime-types (3.4.1)
|
||||||
|
mime-types-data (~> 3.2015)
|
||||||
|
mime-types-data (3.2023.0218.1)
|
||||||
mimemagic (0.3.10)
|
mimemagic (0.3.10)
|
||||||
nokogiri (~> 1)
|
nokogiri (~> 1)
|
||||||
rake
|
rake
|
||||||
|
@ -193,6 +205,7 @@ GEM
|
||||||
mustermann (1.1.1)
|
mustermann (1.1.1)
|
||||||
ruby2_keywords (~> 0.0.1)
|
ruby2_keywords (~> 0.0.1)
|
||||||
mysql2 (0.5.3)
|
mysql2 (0.5.3)
|
||||||
|
netrc (0.11.0)
|
||||||
nio4r (2.5.2)
|
nio4r (2.5.2)
|
||||||
nokogiri (1.10.8)
|
nokogiri (1.10.8)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
|
@ -209,9 +222,21 @@ GEM
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.3)
|
||||||
nokogiri (~> 1.5)
|
nokogiri (~> 1.5)
|
||||||
omniauth (~> 1.2)
|
omniauth (~> 1.2)
|
||||||
|
omniauth-gitee (1.0.0)
|
||||||
|
omniauth (>= 1.5, < 3.0)
|
||||||
|
omniauth-oauth2 (>= 1.4.0, < 2.0)
|
||||||
|
omniauth-github (1.4.0)
|
||||||
|
omniauth (~> 1.5)
|
||||||
|
omniauth-oauth2 (>= 1.4.0, < 2.0)
|
||||||
omniauth-oauth2 (1.6.0)
|
omniauth-oauth2 (1.6.0)
|
||||||
oauth2 (~> 1.1)
|
oauth2 (~> 1.1)
|
||||||
omniauth (~> 1.9)
|
omniauth (~> 1.9)
|
||||||
|
omniauth-rails_csrf_protection (0.1.2)
|
||||||
|
actionpack (>= 4.2)
|
||||||
|
omniauth (>= 1.3.1)
|
||||||
|
omniauth-wechat-oauth2 (0.2.2)
|
||||||
|
omniauth (>= 1.3.2)
|
||||||
|
omniauth-oauth2 (>= 1.1.1)
|
||||||
parallel (1.19.1)
|
parallel (1.19.1)
|
||||||
parser (2.7.1.1)
|
parser (2.7.1.1)
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
|
@ -221,6 +246,14 @@ GEM
|
||||||
popper_js (1.16.0)
|
popper_js (1.16.0)
|
||||||
powerpack (0.1.2)
|
powerpack (0.1.2)
|
||||||
prettier (0.18.2)
|
prettier (0.18.2)
|
||||||
|
pry (0.12.2)
|
||||||
|
coderay (~> 1.1.0)
|
||||||
|
method_source (~> 0.9.0)
|
||||||
|
pry-rails (0.3.9)
|
||||||
|
pry (>= 0.10.4)
|
||||||
|
pry-remote (0.1.8)
|
||||||
|
pry (~> 0.9)
|
||||||
|
slop (~> 3.0)
|
||||||
public_suffix (4.0.3)
|
public_suffix (4.0.3)
|
||||||
puma (3.12.2)
|
puma (3.12.2)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
|
@ -292,6 +325,11 @@ GEM
|
||||||
regexp_parser (1.7.0)
|
regexp_parser (1.7.0)
|
||||||
request_store (1.5.0)
|
request_store (1.5.0)
|
||||||
rack (>= 1.4)
|
rack (>= 1.4)
|
||||||
|
rest-client (2.1.0)
|
||||||
|
http-accept (>= 1.7.0, < 2.0)
|
||||||
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
|
mime-types (>= 1.16, < 4.0)
|
||||||
|
netrc (~> 0.8)
|
||||||
reverse_markdown (1.4.0)
|
reverse_markdown (1.4.0)
|
||||||
nokogiri
|
nokogiri
|
||||||
roo (2.8.3)
|
roo (2.8.3)
|
||||||
|
@ -380,6 +418,7 @@ GEM
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
rack-protection (= 2.0.8.1)
|
rack-protection (= 2.0.8.1)
|
||||||
tilt (~> 2.0)
|
tilt (~> 2.0)
|
||||||
|
slop (3.6.0)
|
||||||
solargraph (0.38.6)
|
solargraph (0.38.6)
|
||||||
backport (~> 1.1)
|
backport (~> 1.1)
|
||||||
benchmark
|
benchmark
|
||||||
|
@ -418,6 +457,9 @@ GEM
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (4.2.0)
|
uglifier (4.2.0)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
|
unf (0.1.4)
|
||||||
|
unf_ext
|
||||||
|
unf_ext (0.0.8.2)
|
||||||
unicode-display_width (1.6.1)
|
unicode-display_width (1.6.1)
|
||||||
web-console (3.7.0)
|
web-console (3.7.0)
|
||||||
actionview (>= 5.0)
|
actionview (>= 5.0)
|
||||||
|
@ -448,6 +490,7 @@ DEPENDENCIES
|
||||||
bootsnap (>= 1.1.0)
|
bootsnap (>= 1.1.0)
|
||||||
bootstrap (~> 4.3.1)
|
bootstrap (~> 4.3.1)
|
||||||
bulk_insert
|
bulk_insert
|
||||||
|
byebug
|
||||||
capybara (>= 2.15, < 4.0)
|
capybara (>= 2.15, < 4.0)
|
||||||
chartkick
|
chartkick
|
||||||
chinese_pinyin
|
chinese_pinyin
|
||||||
|
@ -459,6 +502,7 @@ DEPENDENCIES
|
||||||
enumerize
|
enumerize
|
||||||
faraday (~> 0.15.4)
|
faraday (~> 0.15.4)
|
||||||
font-awesome-sass (= 4.7.0)
|
font-awesome-sass (= 4.7.0)
|
||||||
|
gitea-client (~> 1.4.1)
|
||||||
grape-entity (~> 0.7.1)
|
grape-entity (~> 0.7.1)
|
||||||
groupdate (~> 4.1.0)
|
groupdate (~> 4.1.0)
|
||||||
harmonious_dictionary (~> 0.0.1)
|
harmonious_dictionary (~> 0.0.1)
|
||||||
|
@ -472,10 +516,16 @@ DEPENDENCIES
|
||||||
oauth2
|
oauth2
|
||||||
omniauth (~> 1.9.0)
|
omniauth (~> 1.9.0)
|
||||||
omniauth-cas
|
omniauth-cas
|
||||||
|
omniauth-gitee (~> 1.0.0)
|
||||||
|
omniauth-github
|
||||||
omniauth-oauth2 (~> 1.6.0)
|
omniauth-oauth2 (~> 1.6.0)
|
||||||
|
omniauth-rails_csrf_protection
|
||||||
|
omniauth-wechat-oauth2
|
||||||
parallel (~> 1.19, >= 1.19.1)
|
parallel (~> 1.19, >= 1.19.1)
|
||||||
pdfkit
|
pdfkit
|
||||||
prettier
|
prettier
|
||||||
|
pry-rails
|
||||||
|
pry-remote
|
||||||
puma (~> 3.11)
|
puma (~> 3.11)
|
||||||
rack-cors
|
rack-cors
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
|
|
|
@ -222,7 +222,7 @@ class Issue < ApplicationRecord
|
||||||
issue.(self, :id, :project_issues_index, :subject, :description)
|
issue.(self, :id, :project_issues_index, :subject, :description)
|
||||||
issue.created_at self.created_on.strftime("%Y-%m-%d %H:%M")
|
issue.created_at self.created_on.strftime("%Y-%m-%d %H:%M")
|
||||||
issue.updated_at self.updated_on.strftime("%Y-%m-%d %H:%M")
|
issue.updated_at self.updated_on.strftime("%Y-%m-%d %H:%M")
|
||||||
issue.tags self.show_issue_tags.map{|t| t.to_builder}
|
issue.tags self.show_issue_tags.map{|t| JSON.parse(t.to_builder.target!)}
|
||||||
issue.status self.issue_status.to_builder
|
issue.status self.issue_status.to_builder
|
||||||
if self.priority.present?
|
if self.priority.present?
|
||||||
issue.priority self.priority.to_builder
|
issue.priority self.priority.to_builder
|
||||||
|
@ -235,11 +235,11 @@ class Issue < ApplicationRecord
|
||||||
issue.milestone nil
|
issue.milestone nil
|
||||||
end
|
end
|
||||||
issue.author self.user.to_builder
|
issue.author self.user.to_builder
|
||||||
issue.assigners self.show_assigners.map{|t| t.to_builder}
|
issue.assigners self.show_assigners.map{|t| JSON.parse(t.to_builder.target!)}
|
||||||
issue.participants self.participants.distinct.map{|t| t.to_builder}
|
issue.participants self.participants.distinct.map{|t| JSON.parse(t.to_builder.target!)}
|
||||||
issue.comment_journals_count self.comment_journals.size
|
issue.comment_journals_count self.comment_journals.size
|
||||||
issue.operate_journals_count self.operate_journals.size
|
issue.operate_journals_count self.operate_journals.size
|
||||||
issue.attachments self.attachments.map{|t| t.to_builder}
|
issue.attachments self.attachments.map{|t| JSON.parse(t.to_builder.target!)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -79,13 +79,13 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
||||||
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id, add_assigner_ids) unless add_assigner_ids.blank?
|
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id, add_assigner_ids) unless add_assigner_ids.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unlock("Api::V1::Issues::UpdateService:#{project.id}:#{issue.id}")
|
||||||
# 触发webhook
|
# 触发webhook
|
||||||
|
Rails.logger.info "################### 触发webhook"
|
||||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueUpdate', @updated_issue&.id, current_user.id, previous_issue_changes.except(:issue_tags_value, :assigned_to_id))
|
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueUpdate', @updated_issue&.id, current_user.id, previous_issue_changes.except(:issue_tags_value, :assigned_to_id))
|
||||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueLabel', @issue&.id, current_user.id, {issue_tag_ids: [before_issue_tag_ids, issue_tag_ids]}) unless issue_tag_ids.nil?
|
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueLabel', @issue&.id, current_user.id, {issue_tag_ids: [before_issue_tag_ids, issue_tag_ids]}) unless issue_tag_ids.nil?
|
||||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueAssign', @issue&.id, current_user.id, {assigner_ids: [before_assigner_ids, assigner_ids]}) unless assigner_ids.nil?
|
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueAssign', @issue&.id, current_user.id, {assigner_ids: [before_assigner_ids, assigner_ids]}) unless assigner_ids.nil?
|
||||||
|
|
||||||
unlock("Api::V1::Issues::UpdateService:#{project.id}:#{issue.id}")
|
|
||||||
|
|
||||||
return @updated_issue
|
return @updated_issue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -82,7 +82,7 @@ class Webhook::IssueClient
|
||||||
before_assigners = User.where(id: @changes["assigner_ids"][0])
|
before_assigners = User.where(id: @changes["assigner_ids"][0])
|
||||||
after_assigners = User.where(id: @changes["assigner_ids"][1])
|
after_assigners = User.where(id: @changes["assigner_ids"][1])
|
||||||
@changes["assigners"] = []
|
@changes["assigners"] = []
|
||||||
@changes["assigners"].append(before_assigners.blank? ? [] : before_assigners.map{|a|JSON.parse(a.to_buidler.target!)})
|
@changes["assigners"].append(before_assigners.blank? ? [] : before_assigners.map{|a|JSON.parse(a.to_builder.target!)})
|
||||||
@changes["assigners"].append(after_assigners.blank? ? [] : after_assigners.map{|a|JSON.parse(a.to_builder.target!)})
|
@changes["assigners"].append(after_assigners.blank? ? [] : after_assigners.map{|a|JSON.parse(a.to_builder.target!)})
|
||||||
@changes.delete("assigner_ids")
|
@changes.delete("assigner_ids")
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
json.total_count @tasks.total_count
|
json.total_count @tasks.total_count
|
||||||
json.tasks @tasks.each do |task|
|
json.tasks @tasks.each do |task|
|
||||||
json.(task, :id, :event_type, :type, :uuid, :is_succeed, :is_delivered, :payload_content, :request_content)
|
json.(task, :id, :event_type, :uuid, :is_succeed, :is_delivered, :payload_content, :request_content)
|
||||||
json.response_content task.response_content
|
json.response_content task.response_content
|
||||||
json.delivered_time task.delivered.present? ? Time.at(task.delivered*10**-9).strftime("%Y-%m-%d %H:%M:%S") : nil
|
json.delivered_time task.delivered.present? ? Time.at(task.delivered*10**-9).strftime("%Y-%m-%d %H:%M:%S") : nil
|
||||||
end
|
end
|
Loading…
Reference in New Issue