Browse Source

fix: educoder sub_entries and commit author

tags/v4.0.0^2
yystopf 4 years ago
parent
commit
33e17e8439
2 changed files with 25 additions and 4 deletions
  1. +12
    -0
      app/controllers/repositories_controller.rb
  2. +13
    -4
      app/views/repositories/_commit.json.jbuilder

+ 12
- 0
app/controllers/repositories_controller.rb View File

@@ -81,6 +81,18 @@ class RepositoriesController < ApplicationController
}
else
@sub_entries = Educoder::Repository::Entries::ListService.call(@project&.project_educoder&.repo_name, {path: file_path_uri})
if @sub_entries.blank?
@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
tmp_entries = [{
"content" => @sub_entries['data']['content'],
"type" => "blob"
}]
@sub_entries = {
"trees"=>tmp_entries,
"commits" => [{}]
}
end
end
else
@path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"


+ 13
- 4
app/views/repositories/_commit.json.jbuilder View File

@@ -7,11 +7,20 @@ 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'])
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.commiter 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 {}
end

if @project.forge?


Loading…
Cancel
Save