fix: educoder file visit delay
This commit is contained in:
parent
beccac652f
commit
0d64768e4b
|
@ -80,18 +80,22 @@ class RepositoriesController < ApplicationController
|
||||||
"commits" => [{}]
|
"commits" => [{}]
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@sub_entries = Educoder::Repository::Entries::ListService.call(@project&.project_educoder&.repo_name, {path: file_path_uri})
|
begin
|
||||||
if @sub_entries.blank?
|
@sub_entries = Educoder::Repository::Entries::ListService.call(@project&.project_educoder&.repo_name, {path: file_path_uri})
|
||||||
@sub_entries = Educoder::Repository::Entries::GetService.call(@project&.project_educoder&.repo_name, file_path_uri)
|
if @sub_entries.blank?
|
||||||
return render_error('该文件暂未开放,敬请期待.') if @sub_entries['status'].to_i === -1
|
@sub_entries = Educoder::Repository::Entries::GetService.call(@project&.project_educoder&.repo_name, file_path_uri)
|
||||||
tmp_entries = [{
|
return render_error('该文件暂未开放,敬请期待.') if @sub_entries['status'].to_i === -1
|
||||||
"content" => @sub_entries['data']['content'],
|
tmp_entries = [{
|
||||||
"type" => "blob"
|
"content" => @sub_entries['data']['content'],
|
||||||
}]
|
"type" => "blob"
|
||||||
@sub_entries = {
|
}]
|
||||||
"trees"=>tmp_entries,
|
@sub_entries = {
|
||||||
"commits" => [{}]
|
"trees"=>tmp_entries,
|
||||||
}
|
"commits" => [{}]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
return render_error('该文件暂未开放,敬请期待.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -129,8 +133,7 @@ class RepositoriesController < ApplicationController
|
||||||
def commit
|
def commit
|
||||||
@sha = params[:sha]
|
@sha = params[:sha]
|
||||||
if @project.educoder?
|
if @project.educoder?
|
||||||
@commit = {}
|
return render_error('暂未开放,敬请期待.')
|
||||||
@commit_diff ={}
|
|
||||||
else
|
else
|
||||||
@commit = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, current_user&.gitea_token)
|
@commit = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, current_user&.gitea_token)
|
||||||
@commit_diff = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, current_user&.gitea_token, {diff: true})
|
@commit_diff = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, current_user&.gitea_token, {diff: true})
|
||||||
|
|
Loading…
Reference in New Issue