forked from Gitlink/forgeplus
动态导航权限控制,没有勾选模块不能进入页面,语言过滤0.0%
动态导航权限控制,没有勾选模块不能进入页面,语言过滤0.0%
This commit is contained in:
commit
c07c570061
|
@ -14,6 +14,6 @@ module Repository::LanguagesPercentagable
|
|||
hash.transform_values { |v|
|
||||
ActionController::Base.helpers
|
||||
.number_to_percentage((v * 100.0 / total_byte_size), precision: 1)
|
||||
}
|
||||
}.select{|k,v| v != "0.0%"}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,7 @@ class IssuesController < ApplicationController
|
|||
include TagChosenHelper
|
||||
|
||||
def index
|
||||
return render_not_found unless @project.has_menu_permission("issues")
|
||||
@user_admin_or_member = current_user.present? && current_user.logged? && (current_user.admin || @project.member?(current_user))
|
||||
issues = @project.issues.issue_issue.issue_index_includes
|
||||
issues = issues.where(is_private: false) unless @user_admin_or_member
|
||||
|
|
|
@ -8,6 +8,7 @@ class PullRequestsController < ApplicationController
|
|||
|
||||
|
||||
def index
|
||||
return render_not_found unless @project.has_menu_permission("pulls")
|
||||
# @issues = Gitea::PullRequest::ListService.new(@user,@repository.try(:identifier)).call #通过gitea获取
|
||||
issues = @project.issues.issue_pull_request.issue_index_includes.includes(pull_request: :user)
|
||||
issues = issues.where(is_private: false) unless current_user.present? && (current_user.admin? || @project.member?(current_user))
|
||||
|
|
|
@ -18,6 +18,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
# 新版项目详情
|
||||
def detail
|
||||
return render_not_found unless @project.has_menu_permission("code")
|
||||
@user = current_user
|
||||
@result = Repositories::DetailService.call(@owner, @repository, @user)
|
||||
@project_fork_id = @project.try(:forked_from_project_id)
|
||||
|
|
|
@ -5,6 +5,7 @@ class VersionsController < ApplicationController
|
|||
before_action :set_version, only: [:edit, :update, :destroy, :show,:update_status]
|
||||
|
||||
def index
|
||||
return render_not_found unless @project.has_menu_permission("versions")
|
||||
@user_admin_or_member = current_user.present? && (current_user.admin || @project.member?(current_user))
|
||||
order_name = params[:order_name] || "created_on"
|
||||
order_type = params[:order_type] || "desc"
|
||||
|
|
|
@ -9,6 +9,7 @@ class Projects::MigrateService < ApplicationService
|
|||
def call
|
||||
@project = Project.new(project_params)
|
||||
if @project.save!
|
||||
ProjectUnit.init_types(@project.id)
|
||||
Project.update_mirror_projects_count!
|
||||
Repositories::MigrateService.new(user, @project, repository_params).call
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue