add: return failed mirror repository field

This commit is contained in:
2021-08-18 15:40:50 +08:00
parent f996525e8e
commit eafc8ea527
3 changed files with 13 additions and 5 deletions

View File

@@ -34,11 +34,12 @@ module ProjectsHelper
end
def json_response(project, user)
repo = Repository.includes(:mirror).select(:id, :mirror_url, :source_clone_url).find_by(project: project)
repo = Repository.includes(:mirror).select(:id, :is_mirror, :mirror_url, :source_clone_url).find_by(project: project)
tmp_json = {}
unless project.common?
tmp_json = tmp_json.merge({
is_mirror: repo.is_mirror ? true : false,
mirror_status: repo.mirror_status,
mirror_num: repo.mirror_num,
mirror_url: repo.remote_mirror_url,
@@ -54,7 +55,11 @@ module ProjectsHelper
repo_id: repo.id,
open_devops: (user.blank? || user.is_a?(AnonymousUser)) ? false : project.open_devops?,
type: project.numerical_for_project_type,
author: render_owner(project)
author: render_owner(project),
project_category_id: project.project_category_id,
project_language_id: project.project_language_id,
license_id: project.license_id,
ignore_id: project.ignore_id
}).compact
render json: tmp_json