mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
fixed 创建仓库开通建木DevOps
This commit is contained in:
18
app/jobs/open_project_dev_ops_job.rb
Normal file
18
app/jobs/open_project_dev_ops_job.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class OpenProjectDevOpsJob < ApplicationJob
|
||||
include ProjectsHelper
|
||||
|
||||
queue_as :message
|
||||
|
||||
def perform(project_id, user_id)
|
||||
project = Project.find_by(id: project_id)
|
||||
user = User.find_by(id: user_id)
|
||||
url = "#{jianmu_devops_url}/#{jianmu_devops_code(project, user)}"
|
||||
puts "jianmu_devops_url ===== #{url}"
|
||||
http = Net::HTTP.new(url.host, url.port)
|
||||
request = Net::HTTP::Get.new(url)
|
||||
response = http.request(request)
|
||||
puts "jianmu_devops_url ===== #{response.body}"
|
||||
SendTemplateMessageJob.perform_later('ProjectOpenDevOps', user_id, project_id)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -217,6 +217,14 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = project&.all_managers.where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectPraised.get_message_content(receivers, operator, project)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, project_id: project.id})
|
||||
when 'ProjectOpenDevOps'
|
||||
operator_id, project_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
project = Project.find_by_id(project_id)
|
||||
return unless operator.present? && project.present?
|
||||
receivers = User.where(id: operator.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectOpenDevOps.get_message_content(receivers, operator, project)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, project_id: project.id})
|
||||
when 'ProjectPullRequest'
|
||||
operator_id, pull_request_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
|
||||
Reference in New Issue
Block a user