修改公开/私有项目的状态

This commit is contained in:
sylor_huang@126.com 2020-04-21 11:37:50 +08:00
parent 147b8573ea
commit c7f7f13630
2 changed files with 6 additions and 6 deletions

View File

@ -113,10 +113,9 @@ class UsersController < ApplicationController
end end
def projects def projects
scope = Projects::ListMyQuery.call(params.merge(category: params[:category]), current_user) scope = Projects::ListMyQuery.call(params.merge(category: params[:category],is_public: params[:status]), current_user)
@total_count = scope.size @total_count = scope.size
@projects = paginate(scope) @projects = paginate(scope)
end end
private private

View File

@ -17,10 +17,11 @@ class Projects::ListMyQuery < ApplicationQuery
else else
projects = Project.where.not(user_id: current_user.id).joins(:members).where(members: { user_id: current_user.id }) projects = Project.where.not(user_id: current_user.id).joins(:members).where(members: { user_id: current_user.id })
end end
scope = projects.includes(:members,:issues,:project_category, :project_language, owner: :user_extension).like(params[:search]) unless params[:is_public].blank?
.with_project_type(params[:project_type]) projects = projects.where(is_public: params[:is_public])
.with_project_category(params[:category_id]) end
.with_project_language(params[:language_id])
scope = projects.includes(:members,:issues,:project_category, :project_language, owner: :user_extension)
sort = params[:sort_by] || "updated_on" sort = params[:sort_by] || "updated_on"
sort_direction = params[:sort_direction] || "desc" sort_direction = params[:sort_direction] || "desc"