mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
cla send issue journal
This commit is contained in:
32
app/services/pull_requests/send_journal_service.rb
Normal file
32
app/services/pull_requests/send_journal_service.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
class PullRequests::SendJournalService < ApplicationService
|
||||
|
||||
def initialize(project, pull_request,current_user)
|
||||
@project = project
|
||||
@issue = pull_request
|
||||
@current_user = current_user
|
||||
@org = project.owner
|
||||
end
|
||||
|
||||
def call
|
||||
if @org.enabling_cla && @org.cla.present? && @org.cla.pr_need && !@org.is_member?(@current_user&.id)
|
||||
ActiveRecord::Base.transaction do
|
||||
sender_id = if Rails.env.development?
|
||||
User.last.id
|
||||
else
|
||||
87461
|
||||
end
|
||||
journal_params = {
|
||||
journalized_id: @issue.id ,
|
||||
journalized_type: "Issue",
|
||||
user_id: sender_id ,
|
||||
notes: "@xxx 您好!欢迎参与 #{@project.name} 的贡献。首次进行贡献请完成《<a href='/#{@project.owner.login}/cla/#{@project.owner.cla.key}' target='_blank'>#{@project.owner.cla.name}</a>》的签署,签署完成后,项目成员才可查看到您的合并请求",
|
||||
}
|
||||
journal = Journal.new journal_params
|
||||
if journal.save
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('PullRequestComment', @issue&.id, sender_id, journal.id, 'created', {})
|
||||
push_activity_2_blockchain("issue_comment_create", journal) if Site.has_blockchain? && @project.use_blockchain
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user