From 05dd162646a0e49e41203111043f97e7891e27ce Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 29 Aug 2024 16:00:46 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E4=B8=AA=E6=A0=87=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=9F=A5=E8=AF=A2,=20=E5=AE=9A=E5=88=B6=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E7=AD=BE=E5=8F=AF=E6=9F=A5=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E4=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/queries/projects/list_query.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/queries/projects/list_query.rb b/app/queries/projects/list_query.rb index 737cd7c2d..931f26145 100644 --- a/app/queries/projects/list_query.rb +++ b/app/queries/projects/list_query.rb @@ -77,7 +77,10 @@ class Projects::ListQuery < ApplicationQuery end def by_project_topic(items) - if params[:topic_name].present? + if params[:topic_name].present? && @current_user_id.present? + Project.visible.where(status: 1).with_project_topic_name(params[:topic_name].to_s.split(",")) + .or(Project.is_private.with_project_topic_name(params[:topic_name].to_s.split(",")).where(user_id: @current_user_id)) + elsif params[:topic_name].present? items.with_project_topic_name(params[:topic_name].to_s.split(",")) else items.with_project_topic(params[:topic_id])