Merge branch 'develop' into trustie_server
This commit is contained in:
commit
ce18cc380a
|
@ -11,7 +11,7 @@ class ProjectsController < ApplicationController
|
||||||
menu = []
|
menu = []
|
||||||
|
|
||||||
menu.append(menu_hash_by_name("home"))
|
menu.append(menu_hash_by_name("home"))
|
||||||
menu.append(menu_hash_by_name("code")) if @project.has_menu_permission("code")
|
menu.append(menu_hash_by_name("code"))
|
||||||
menu.append(menu_hash_by_name("issues")) if @project.has_menu_permission("issues")
|
menu.append(menu_hash_by_name("issues")) if @project.has_menu_permission("issues")
|
||||||
menu.append(menu_hash_by_name("pulls")) if @project.has_menu_permission("pulls")
|
menu.append(menu_hash_by_name("pulls")) if @project.has_menu_permission("pulls")
|
||||||
menu.append(menu_hash_by_name("devops")) if @project.has_menu_permission("devops")
|
menu.append(menu_hash_by_name("devops")) if @project.has_menu_permission("devops")
|
||||||
|
@ -26,7 +26,7 @@ class ProjectsController < ApplicationController
|
||||||
scope = Projects::ListQuery.call(params)
|
scope = Projects::ListQuery.call(params)
|
||||||
|
|
||||||
# @projects = kaminari_paginate(scope)
|
# @projects = kaminari_paginate(scope)
|
||||||
@projects = paginate scope.includes(:project_category, :project_language, :repository, :project_educoder, :owner)
|
@projects = paginate scope.includes(:project_category, :project_language, :repository, :project_educoder, :owner, :project_units)
|
||||||
|
|
||||||
category_id = params[:category_id]
|
category_id = params[:category_id]
|
||||||
@total_count =
|
@total_count =
|
||||||
|
|
|
@ -18,7 +18,6 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
# 新版项目详情
|
# 新版项目详情
|
||||||
def detail
|
def detail
|
||||||
return render_not_found unless @project.has_menu_permission("code")
|
|
||||||
@user = current_user
|
@user = current_user
|
||||||
@result = Repositories::DetailService.call(@owner, @repository, @user)
|
@result = Repositories::DetailService.call(@owner, @repository, @user)
|
||||||
@project_fork_id = @project.try(:forked_from_project_id)
|
@project_fork_id = @project.try(:forked_from_project_id)
|
||||||
|
|
|
@ -46,7 +46,6 @@ class Projects::CreateService < ApplicationService
|
||||||
{
|
{
|
||||||
hidden: !repo_is_public,
|
hidden: !repo_is_public,
|
||||||
user_id: params[:user_id],
|
user_id: params[:user_id],
|
||||||
website: params[:website],
|
|
||||||
identifier: params[:repository_name]
|
identifier: params[:repository_name]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
json.content @project.content
|
json.content @project.content
|
||||||
json.website @project.website
|
json.website @project.website
|
||||||
json.readme @result[:readme].merge(content: readme_render_decode64_content(@result[:readme]["content"], nil))
|
if @result[:readme].blank?
|
||||||
|
json.readme nil!
|
||||||
|
else
|
||||||
|
json.readme @result[:readme].merge(content: readme_render_decode64_content(@result[:readme]["content"], nil))
|
||||||
|
end
|
||||||
json.identifier render_identifier(@project)
|
json.identifier render_identifier(@project)
|
||||||
json.name @project.name
|
json.name @project.name
|
||||||
json.project_id @project.id
|
json.project_id @project.id
|
||||||
|
@ -48,7 +52,7 @@ if @result[:repo]
|
||||||
json.private @result[:repo]['private']
|
json.private @result[:repo]['private']
|
||||||
end
|
end
|
||||||
json.license_name @project.license_name
|
json.license_name @project.license_name
|
||||||
json.release_versions do
|
json.release_versions do
|
||||||
json.list @result[:release].each do |release|
|
json.list @result[:release].each do |release|
|
||||||
forge_version = VersionRelease.find_by(version_gid: release["id"])
|
forge_version = VersionRelease.find_by(version_gid: release["id"])
|
||||||
json.id forge_version&.id
|
json.id forge_version&.id
|
||||||
|
@ -58,23 +62,23 @@ json.release_versions do
|
||||||
end
|
end
|
||||||
json.total_count @result[:release].size
|
json.total_count @result[:release].size
|
||||||
end
|
end
|
||||||
json.branches do
|
json.branches do
|
||||||
json.list @result[:branch].each do |branch|
|
json.list @result[:branch].each do |branch|
|
||||||
json.name branch["name"]
|
json.name branch["name"]
|
||||||
end
|
end
|
||||||
json.total_count @result[:branch].size
|
json.total_count @result[:branch].size
|
||||||
end
|
end
|
||||||
json.tags do
|
json.tags do
|
||||||
json.list @result[:tag].each do |tag|
|
json.list @result[:tag].each do |tag|
|
||||||
json.name tag["name"]
|
json.name tag["name"]
|
||||||
end
|
end
|
||||||
json.total_count @result[:tag].size
|
json.total_count @result[:tag].size
|
||||||
end
|
end
|
||||||
json.contributors do
|
json.contributors do
|
||||||
total_count = @result[:contributor].size
|
total_count = @result[:contributor].size
|
||||||
json.list @result[:contributor].each do |contributor|
|
json.list @result[:contributor].each do |contributor|
|
||||||
user = User.find_by(gitea_uid: contributor["id"])
|
user = User.find_by(gitea_uid: contributor["id"])
|
||||||
if contributor["login"] == "root"
|
if contributor["login"] == "root"
|
||||||
total_count -= 1
|
total_count -= 1
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue