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

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
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
@projects = paginate(scope)
end
private

View File

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