forked from Gitlink/forgeplus
首页只显示公开的项目
This commit is contained in:
parent
f073b66880
commit
e4ebf6e828
|
@ -4,19 +4,12 @@ class ProjectCategoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def group_list
|
||||
# is_admin = current_user && current_user&.admin?
|
||||
# if is_admin
|
||||
# projects = Project.all
|
||||
# elsif current_user&.logged?
|
||||
# if current_user&.logged?
|
||||
# projects = Project.list_user_projects(current_user.id)
|
||||
# else
|
||||
# projects = Project.visible
|
||||
# end
|
||||
if current_user&.logged?
|
||||
projects = Project.list_user_projects(current_user.id)
|
||||
else
|
||||
projects = Project.visible
|
||||
end
|
||||
@category_group_list = projects.no_anomory_projects.joins(:project_category).group("project_categories.id", "project_categories.name").size
|
||||
projects = Project.no_anomory_projects.visible
|
||||
@category_group_list = projects.joins(:project_category).group("project_categories.id", "project_categories.name").size
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,23 +40,13 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def group_type_list
|
||||
# is_admin = current_user && current_user&.admin?
|
||||
# if is_admin
|
||||
# projects = Project.all
|
||||
# elsif current_user&.logged?
|
||||
#
|
||||
# if current_user&.logged?
|
||||
# projects = Project.list_user_projects(current_user.id)
|
||||
# else
|
||||
# projects = Project.visible
|
||||
# end
|
||||
#
|
||||
if current_user&.logged?
|
||||
projects = Project.list_user_projects(current_user.id)
|
||||
else
|
||||
projects = Project.visible
|
||||
end
|
||||
# projects = Project.visible
|
||||
@project_group_list = projects.no_anomory_projects.group(:project_type).size
|
||||
projects = Project.no_anomory_projects.visible
|
||||
@project_group_list = projects.group(:project_type).size
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
@ -10,20 +10,14 @@ class Projects::ListQuery < ApplicationQuery
|
|||
end
|
||||
|
||||
def call
|
||||
# if params[:is_admin]
|
||||
# projects = Project.all
|
||||
# elsif params[:user_id].to_i != 2
|
||||
|
||||
# if params[:user_id].to_i != 2 && params[:user_id].to_i != 0
|
||||
# projects = Project.list_user_projects(params[:user_id])
|
||||
# else
|
||||
# projects = Project.visible
|
||||
# end
|
||||
|
||||
if params[:user_id].to_i != 2 && params[:user_id].to_i != 0
|
||||
projects = Project.list_user_projects(params[:user_id])
|
||||
else
|
||||
projects = Project.visible #匿名用户的项目
|
||||
end
|
||||
scope = projects.no_anomory_projects.includes(:project_category, :project_language, :repository, owner: :user_extension).like(params[:search])
|
||||
projects = Project.no_anomory_projects.visible
|
||||
scope = projects.includes(:project_category, :project_language, :repository, owner: :user_extension).like(params[:search])
|
||||
.with_project_type(params[:project_type])
|
||||
.with_project_category(params[:category_id])
|
||||
.with_project_language(params[:language_id]).distinct
|
||||
|
|
Loading…
Reference in New Issue