Merge pull request '同步代码' (#288) from develop into standalone_develop

This commit is contained in:
2021-12-10 09:19:42 +08:00
7 changed files with 57 additions and 21 deletions

View File

@@ -7,11 +7,22 @@ if @project.educoder?
json.timestamp 0
json.time_from_now commit[0]['time']
end
json.author do
{}
# json.partial! '/projects/author', user: render_commit_author(commit['author'])
end
json.committer {}
if commit[0]['author'].present?
json.author do
json.id nil
json.login commit[0]['author']['username']
json.name commit[0]['author']['username']
json.type nil
json.image_url commit[0]['author']['image_url']
end
json.committer do
json.id nil
json.login commit[0]['author']['username']
json.name commit[0]['author']['username']
json.type nil
json.image_url commit[0]['author']['image_url']
end
end
end
if @project.forge?

View File

@@ -32,6 +32,8 @@ end
if @project.educoder?
file_path = params[:filepath].present? ? [params[:filepath], entry['name']].join('/') : entry['name']
file_type = File.extname(entry['name'].to_s)[1..-1]
image_type = image_type?(file_type)
json.name entry['name']
json.sha nil
@@ -42,7 +44,7 @@ if @project.educoder?
json.target nil
json.download_url nil
json.direct_download false
json.image_type false
json.image_type image_type
json.is_readme_file false
json.commit do
json.message entry['title']

View File

@@ -12,7 +12,7 @@ if @hash_commit.blank? || @project.educoder? #如果有状态值,则表示
json.type nil
json.image_url commit['author']['image_url']
end
json.commiter do
json.committer do
json.id nil
json.login commit['author']['username']
json.name commit['author']['username']

View File

@@ -24,8 +24,12 @@ if @project.educoder?
end
end
json.entries do
json.array! @sub_entries['trees'] do |entry|
json.partial! 'repositories/simple_entry', locals: { entry: entry }
if @sub_entries['trees'].is_a?(Array)
json.array! @sub_entries['trees'] do |entry|
json.partial! 'repositories/simple_entry', locals: { entry: entry }
end
elsif @sub_entries['trees'].is_a?(Hash)
json.partial! 'repositories/simple_entry', locals: { entry: @sub_entries['trees'] }
end
end
end