change push_activity_2_blockchain by querying projects with identifier

This commit is contained in:
zhangxunhui 2023-02-03 13:19:27 +08:00
parent 7aca2e487e
commit 7b1b03ab41
1 changed files with 12 additions and 4 deletions

View File

@ -1378,7 +1378,8 @@ class ApplicationController < ActionController::Base
end end
pull_request_id = model['id'] pull_request_id = model['id']
reponame = project['name'] identifier = project['identifier']
reponame = project['reponame']
owner_id = project['user_id'] owner_id = project['user_id']
owner = User.find(owner_id) owner = User.find(owner_id)
ownername = owner['login'] ownername = owner['login']
@ -1402,7 +1403,10 @@ class ApplicationController < ActionController::Base
updated_at = model['updated_at'] updated_at = model['updated_at']
# 查询pull request对应的commit信息 # 查询pull request对应的commit信息
commits = Gitea::PullRequest::CommitsService.call(ownername, reponame, model['gitea_number']) commits = Gitea::PullRequest::CommitsService.call(ownername, identifier, model['gitea_number'])
if commits.nil?
return false # 获取pr中变更的commit信息失败
end
commit_shas = [] commit_shas = []
commits.each do |c| commits.each do |c|
commit_shas << c["Sha"] commit_shas << c["Sha"]
@ -1439,7 +1443,8 @@ class ApplicationController < ActionController::Base
end end
pull_request_id = model['id'] pull_request_id = model['id']
reponame = project['name'] identifier = project['identifier']
reponame = project['reponame']
owner_id = project['user_id'] owner_id = project['user_id']
owner = User.find(owner_id) owner = User.find(owner_id)
ownername = owner['login'] ownername = owner['login']
@ -1450,7 +1455,10 @@ class ApplicationController < ActionController::Base
updated_at = model['updated_at'] updated_at = model['updated_at']
# 查询pull request对应的commit信息 # 查询pull request对应的commit信息
commits = Gitea::PullRequest::CommitsService.call(ownername, reponame, model['gitea_number']) commits = Gitea::PullRequest::CommitsService.call(ownername, identifier, model['gitea_number'])
if commits.nil?
return false # 获取pr中变更的commit信息失败
end
commit_shas = [] commit_shas = []
commits.each do |c| commits.each do |c|
commit_shas << c["Sha"] commit_shas << c["Sha"]