新增:新版疑修上链操作

This commit is contained in:
2023-03-02 17:06:49 +08:00
parent aba5de8bb8
commit c9c16aef8d
7 changed files with 34 additions and 12 deletions

View File

@@ -77,7 +77,7 @@ class PullRequestsController < ApplicationController
# author: zxh
# 调用上链API
push_activity_2_blockchain("pull_request_create", @pull_request)
push_activity_2_blockchain("pull_request_create", @pull_request) if Site.has_blockchain?
else
render_error("create pull request error: #{@gitea_pull_request[:status]}")
@@ -169,7 +169,7 @@ class PullRequestsController < ApplicationController
colsed = PullRequests::CloseService.call(@owner, @repository, @pull_request, current_user)
# author: zxh
# 调用上链API
push_activity_2_blockchain("pull_request_refuse", @pull_request)
push_activity_2_blockchain("pull_request_refuse", @pull_request) if Site.has_blockchain?
if colsed === true
@pull_request.project_trends.create!(user: current_user, project: @project,action_type: ProjectTrend::CLOSE)
@@ -223,7 +223,7 @@ class PullRequestsController < ApplicationController
# author: zxh
# 调用上链API
push_activity_2_blockchain("pull_request_merge", @pull_request)
push_activity_2_blockchain("pull_request_merge", @pull_request) if Site.has_blockchain?
# 查看是否fix了相关issue如果fix就转账
@pull_request.attached_issues.each do |issue|
@@ -231,7 +231,7 @@ class PullRequestsController < ApplicationController
token_num = token_num.nil? ? 0 : token_num
author_id = @pull_request.user_id
if token_num > 0
Blockchain::FixIssue.call({user_id: author_id.to_s, project_id: project.id.to_s, token_num: token_num})
Blockchain::FixIssue.call({user_id: author_id.to_s, project_id: project.id.to_s, token_num: token_num}) if Site.has_blockchain?
end
# update issue to state 5
issue.update(status_id: 5)