修改不显示匿名用户的项目
This commit is contained in:
parent
3229f8ce89
commit
f07a10ad99
|
@ -29,6 +29,7 @@ class Project < ApplicationRecord
|
|||
|
||||
after_save :check_project_members
|
||||
scope :project_statics_select, -> {select(:id,:name, :is_public, :identifier, :status, :project_type, :user_id, :forked_count, :visits, :project_category_id, :project_language_id, :license_id, :ignore_id, :watchers_count, :created_on)}
|
||||
scope :no_anomory_projects, -> {where("user_id != ?", 2)}
|
||||
|
||||
|
||||
# 创建者
|
||||
|
@ -104,7 +105,7 @@ class Project < ApplicationRecord
|
|||
user_not_show_1 = projects.where("user_id != ?",user_id).pluck(:id).uniq
|
||||
|
||||
user_show_2 = projects.joins(:members).where("members.user_id = ?", user_id).pluck(:id).uniq
|
||||
Project.where.not(id: (user_not_show_1 - user_show_2).uniq)
|
||||
Project.no_anomory_projects.where("user_id != ?", 2).where.not(id: (user_not_show_1 - user_show_2).uniq)
|
||||
end
|
||||
|
||||
def members_count
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue