diff --git a/lib/CF/Controller/Posts.pm b/lib/CF/Controller/Posts.pm index eac8110effbc218ced88432ba93b1d9600a8a7e9..54dcdab6fb6b9e750b19412d3d8117b1a51adf88 100644 --- a/lib/CF/Controller/Posts.pm +++ b/lib/CF/Controller/Posts.pm @@ -47,15 +47,22 @@ sub list ($c) { my ($cond, $attrs) = $c->search_parametrs( $args ); - $cond->{type} = $args->{type}; - if ( exists $args->{archived} && defined $args->{archived}) { $cond->{is_archived} = $args->{archived}; } - # neschvalene navrhy postupu - if ( $args->{type} == 0 && ! $c->user_roles->{chairman} ) { - $cond->{state} = {'-in' => [1,2,3,4]} + # omezeni zobrazovani nepotvrzenych navrhu postupu + if ( $args->{type} ) { + $cond->{type} = $args->{type}; + if ( $args->{type} == 0 && ! $c->user_roles->{chairman} ) { + $cond->{state} = {'-in' => [1,2,3,4]} + } + } + elsif (! $c->user_roles->{chairman}) { + $cond->{-or} => [ + { type => 1 }, + { state => { '-in' => [1,2,3,4] }}, + ]; } my @posts = (); diff --git a/openapi.yaml b/openapi.yaml index a54058b83a57ce8849513c3c3c329b5a33415f4f..896e31d088a3fea388c23c93bdb0f615445a3fa4 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -176,7 +176,7 @@ paths: - name: type in: query description: "Typ zpravy" - required: true + required: false schema: type: integer enum: [0, 1]