@@ -73,6 +73,8 @@ pub struct SearchProjectsFilter {
7373 pub project_type : Vec < ProjectTypeId > ,
7474 #[ serde( default ) ]
7575 pub replied_to : Option < RepliedTo > ,
76+ #[ serde( default ) ]
77+ pub project_status : Vec < ProjectStatus > ,
7678}
7779
7880/// Filter by whether a moderator has replied to the last message in the
@@ -524,11 +526,13 @@ async fn search_projects(
524526 -- project type
525527 (cardinality($4::int[]) = 0 OR c.project_type = ANY($4::int[]))
526528 AND m.status NOT IN ('draft', 'rejected', 'withheld')
529+ -- project status
530+ AND (cardinality($6::text[]) = 0 OR m.status = ANY($6::text[]))
527531 -- replied/unreplied filter
528532 AND (
529533 $5::text IS NULL
530- OR ($5::text = 'replied ' AND (tm_last.id IS NULL OR u_last.role IS NULL OR u_last.role NOT IN ('moderator', 'admin')))
531- OR ($5::text = 'unreplied ' AND tm_last.id IS NOT NULL AND u_last.role IS NOT NULL AND u_last.role IN ('moderator', 'admin'))
534+ OR ($5::text = 'unreplied ' AND (tm_last.id IS NULL OR u_last.role IS NULL OR u_last.role NOT IN ('moderator', 'admin')))
535+ OR ($5::text = 'replied ' AND tm_last.id IS NOT NULL AND u_last.role IS NOT NULL AND u_last.role IN ('moderator', 'admin'))
532536 )
533537
534538 GROUP BY m.id, t.id
@@ -555,6 +559,12 @@ async fn search_projects(
555559 . map( |ty| ty. 0 )
556560 . collect:: <Vec <_>>( ) ,
557561 replied_to_filter. as_deref( ) ,
562+ & search_req
563+ . filter
564+ . project_status
565+ . iter( )
566+ . map( |status| status. to_string( ) )
567+ . collect:: <Vec <_>>( )
558568 )
559569 . fetch ( & * * pool) ;
560570
0 commit comments