FIX bug
This commit is contained in:
parent
91c9423c72
commit
bfbe1fdce5
|
@ -47,9 +47,20 @@ class RepositoriesController < ApplicationController
|
|||
if @project.educoder?
|
||||
if params[:type] === 'file'
|
||||
@sub_entries = Educoder::Repository::Entries::GetService.call(@project&.project_educoder&.repo_name, file_path_uri)
|
||||
logger.info "######### sub_entries: #{@sub_entries}"
|
||||
return render_error('该文件暂未开放,敬请期待.') if @sub_entries['status'].to_i === -1
|
||||
|
||||
tmp_entries = [{
|
||||
"content" => @sub_entries['data']['content'],
|
||||
"type" => "blob"
|
||||
}]
|
||||
@sub_entries = {
|
||||
"trees"=>tmp_entries,
|
||||
"commits" => [{}]
|
||||
}
|
||||
else
|
||||
@sub_entries = Educoder::Repository::Entries::ListService.call(@project&.project_educoder&.repo_name, {path: file_path_uri})
|
||||
end
|
||||
@sub_entries = Educoder::Repository::Entries::ListService.call(@project&.project_educoder&.repo_name, {path: file_path_uri})
|
||||
else
|
||||
interactor = Repositories::EntriesInteractor.call(@project.owner, @project.identifier, file_path_uri, ref: @ref)
|
||||
if interactor.success?
|
||||
|
|
|
@ -30,7 +30,7 @@ module ProjectsHelper
|
|||
|
||||
def json_response(project, user)
|
||||
# repo = project.repository
|
||||
repo = Repository.select(:id).find_by(project: project)
|
||||
repo = Repository.select(:id, :mirror_url).find_by(project: project)
|
||||
|
||||
tmp_json = {}
|
||||
unless project.common?
|
||||
|
@ -83,6 +83,6 @@ module ProjectsHelper
|
|||
end
|
||||
|
||||
def render_avatar_url(owner)
|
||||
[Rails.application.config_for(:configuration)['platform_url'], 'images', url_to_avatar(owner)].join('/')
|
||||
['images', url_to_avatar(owner)].join('/')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ if @project.educoder?
|
|||
json.path file_path
|
||||
json.type entry['type'] === 'blob'? 'file' : 'dir'
|
||||
json.size 0
|
||||
json.content nil
|
||||
json.content entry['content']
|
||||
json.target nil
|
||||
json.download_url nil
|
||||
json.direct_download false
|
||||
|
|
|
@ -47,4 +47,4 @@ if @result
|
|||
json.private @result['private']
|
||||
end
|
||||
|
||||
json.partial! 'author'
|
||||
json.partial! 'author', locals: { user: @project.owner }
|
||||
|
|
Loading…
Reference in New Issue