fix: educoder entries file use hash
This commit is contained in:
parent
0d64768e4b
commit
102858bc8c
|
@ -71,7 +71,7 @@ class RepositoriesController < ApplicationController
|
||||||
logger.info "######### sub_entries: #{@sub_entries}"
|
logger.info "######### sub_entries: #{@sub_entries}"
|
||||||
return render_error('该文件暂未开放,敬请期待.') if @sub_entries['status'].to_i === -1
|
return render_error('该文件暂未开放,敬请期待.') if @sub_entries['status'].to_i === -1
|
||||||
|
|
||||||
tmp_entries = [{
|
tmp_entries = {
|
||||||
"content" => @sub_entries['data']['content'],
|
"content" => @sub_entries['data']['content'],
|
||||||
"type" => "blob"
|
"type" => "blob"
|
||||||
}]
|
}]
|
||||||
|
@ -82,13 +82,13 @@ class RepositoriesController < ApplicationController
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@sub_entries = Educoder::Repository::Entries::ListService.call(@project&.project_educoder&.repo_name, {path: file_path_uri})
|
@sub_entries = Educoder::Repository::Entries::ListService.call(@project&.project_educoder&.repo_name, {path: file_path_uri})
|
||||||
if @sub_entries.blank?
|
if @sub_entries.blank? || @sub_entries['status'].to_i === -1
|
||||||
@sub_entries = Educoder::Repository::Entries::GetService.call(@project&.project_educoder&.repo_name, file_path_uri)
|
@sub_entries = Educoder::Repository::Entries::GetService.call(@project&.project_educoder&.repo_name, file_path_uri)
|
||||||
return render_error('该文件暂未开放,敬请期待.') if @sub_entries['status'].to_i === -1
|
return render_error('该文件暂未开放,敬请期待.') if @sub_entries['status'].to_i === -1
|
||||||
tmp_entries = [{
|
tmp_entries = [{
|
||||||
"content" => @sub_entries['data']['content'],
|
"content" => @sub_entries['data']['content'],
|
||||||
"type" => "blob"
|
"type" => "blob"
|
||||||
}]
|
}
|
||||||
@sub_entries = {
|
@sub_entries = {
|
||||||
"trees"=>tmp_entries,
|
"trees"=>tmp_entries,
|
||||||
"commits" => [{}]
|
"commits" => [{}]
|
||||||
|
|
|
@ -7,20 +7,22 @@ if @project.educoder?
|
||||||
json.timestamp 0
|
json.timestamp 0
|
||||||
json.time_from_now commit[0]['time']
|
json.time_from_now commit[0]['time']
|
||||||
end
|
end
|
||||||
json.author do
|
if commit[0]['author'].present?
|
||||||
json.id nil
|
json.author do
|
||||||
json.login commit[0]['author']['username']
|
json.id nil
|
||||||
json.name commit[0]['author']['username']
|
json.login commit[0]['author']['username']
|
||||||
json.type nil
|
json.name commit[0]['author']['username']
|
||||||
json.image_url commit[0]['author']['image_url']
|
json.type nil
|
||||||
end
|
json.image_url commit[0]['author']['image_url']
|
||||||
json.committer do
|
end
|
||||||
json.id nil
|
json.committer do
|
||||||
json.login commit[0]['author']['username']
|
json.id nil
|
||||||
json.name commit[0]['author']['username']
|
json.login commit[0]['author']['username']
|
||||||
json.type nil
|
json.name commit[0]['author']['username']
|
||||||
json.image_url commit[0]['author']['image_url']
|
json.type nil
|
||||||
end
|
json.image_url commit[0]['author']['image_url']
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @project.forge?
|
if @project.forge?
|
||||||
|
|
|
@ -24,8 +24,6 @@ if @project.educoder?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
json.entries do
|
json.entries do
|
||||||
json.array! @sub_entries['trees'] do |entry|
|
json.partial! 'repositories/simple_entry', locals: { entry: @sub_entries['trees']}
|
||||||
json.partial! 'repositories/simple_entry', locals: { entry: entry }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue