Merge branch 'standalone_develop' into pre_trustie_server

This commit is contained in:
yystopf 2024-03-27 17:19:07 +08:00
commit 59a6e3121e
5 changed files with 15 additions and 5 deletions

View File

@ -11,6 +11,9 @@ class Api::V1::Projects::CommitsController < Api::V1::BaseController
end
def recent
@result_object = Api::V1::Projects::Commits::RecentService.call(@project, {keyword: params[:keyword], page: page, limit: limit}, current_user&.gitea_token)
hash = Api::V1::Projects::Commits::RecentService.call(@project, {keyword: params[:keyword], page: page, limit: limit}, current_user&.gitea_token)
@result_object = hash[:result]
@object_detail = hash[:detail]
puts @object_detail
end
end

View File

@ -30,7 +30,7 @@ class Oauth::AcgeController < Oauth::BaseController
return
else
username = uid[0..7]
username = uid
password = SecureRandom.hex(4)
reg_result = autologin_register(username, email, password, 'acge', phone, name)
existing_rows = CSV.read("public/操作系统大赛用户信息.csv")

View File

@ -135,7 +135,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
end
def build_previous_issue_changes
@previous_issue_changes.merge!(@updated_issue.previous_changes.slice("status_id", "priority_id", "fixed_version_id", "issue_tags_value", "branch_name", "subject", "description").symbolize_keys)
@previous_issue_changes.merge!(@updated_issue.previous_changes.slice("status_id", "priority_id", "fixed_version_id", "issue_tags_value", "branch_name", "subject").symbolize_keys)
if @updated_issue.previous_changes[:start_date].present?
@previous_issue_changes.merge!(start_date: [@updated_issue.previous_changes[:start_date][0].to_s, @updated_issue.previous_changes[:start_date][1].to_s])
end

View File

@ -1,7 +1,7 @@
class Api::V1::Projects::Commits::RecentService < ApplicationService
attr_reader :project, :page, :limit, :keyword, :owner, :repo, :token
attr_accessor :gitea_data
attr_accessor :gitea_data, :gitea_repo_detail
def initialize(project, params, token=nil)
@project = project
@ -15,8 +15,9 @@ class Api::V1::Projects::Commits::RecentService < ApplicationService
def call
load_gitea_data
load_gitea_repo_detail
gitea_data
{result: gitea_data, detail:gitea_repo_detail}
end
private
@ -36,4 +37,8 @@ class Api::V1::Projects::Commits::RecentService < ApplicationService
raise Error, "获取最近提交列表失败" unless @gitea_data.is_a?(Hash)
end
def load_gitea_repo_detail
@gitea_repo_detail = $gitea_client.get_repos_by_owner_repo(owner, repo, {query: {access_token: token}})
raise Error, "获取项目详情失败" unless @gitea_repo_detail.is_a?(Hash)
end
end

View File

@ -1,4 +1,6 @@
json.total_count @result_object[:total_data].to_i
json.ssh_url @object_detail['ssh_url']
json.clone_url @object_detail['clone_url']
json.commits @result_object[:data].each do |commit|
json.sha commit['sha']
json.author do