修改不显示匿名用户的项目

This commit is contained in:
sylor_huang@126.com
2020-04-21 19:03:06 +08:00
parent 3229f8ce89
commit f07a10ad99
2 changed files with 5 additions and 4 deletions

View File

@@ -17,11 +17,11 @@ class Projects::ListQuery < ApplicationQuery
# else
# projects = Project.visible
# end
projects = Project.where("user_id != ?", 2) #匿名用户的项目
if params[:user_id].to_i != 2 && params[:user_id].to_i != 0
projects = projects.list_user_projects(params[:user_id])
projects = Project.list_user_projects(params[:user_id])
else
projects = projects.visible
projects = Project.no_anomory_projects.visible #匿名用户的项目
end
scope = projects.includes(:project_category, :project_language, :repository, owner: :user_extension).like(params[:search])
.with_project_type(params[:project_type])