fix: educoder clone url

This commit is contained in:
yystopf 2021-12-08 16:18:13 +08:00
parent 422549f9e7
commit e0c47c2abd
4 changed files with 25 additions and 5 deletions

View File

@ -96,7 +96,7 @@ class RepositoriesController < ApplicationController
def commits
if @project.educoder?
@hash_commit = nil
@commits = Educoder::Repository::Commits::ListService.call(@project&.project_educoder&.repo_name)
else
if params[:filepath].present?
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))

View File

@ -1,6 +1,26 @@
if @hash_commit.blank? #如果有状态值,则表示报错了
if @hash_commit.blank? || @project.educoder? #如果有状态值,则表示报错了
json.total_count 0
json.commits []
json.commits do
json.array! @commits do |commit|
json.sha commit['id']
json.message commit['title']
json.time_from_now commit['time']
json.author do
json.id nil
json.login commit['author']['username']
json.name commit['author']['username']
json.type nil
json.image_url commit['author']['image_url']
end
json.commiter do
json.id nil
json.login commit['author']['username']
json.name commit['author']['username']
json.type nil
json.image_url commit['author']['image_url']
end
end
end
else
json.total_count @hash_commit[:total_count]
json.commits do

View File

@ -44,7 +44,7 @@ end
if @result[:repo]
json.size replace_bytes_to_b(number_to_human_size(@result[:repo]['size'].to_i*1024))
json.ssh_url @result[:repo]['ssh_url']
json.clone_url @result[:repo]['clone_url']
json.clone_url @project.educoder? ? "#{Rails.application.config_for(:configuration)['educoder']['git_site']}/#{@project&.project_educoder&.repo_name}.git" : @result[:repo]['clone_url']
json.default_branch @project.educoder? ? "master" : @result[:repo]['default_branch']
json.empty @result[:repo]['empty']
json.full_name @result[:repo]['full_name']

View File

@ -7,7 +7,7 @@ if @project.educoder?
end
end
json.commits_count @entries['commit_count']
json.zip_url @entries['git_url']
json.zip_url ''
json.tar_url ''
json.entries do
json.array! @entries['trees'] do |entry|