diff --git a/lib/CF/Controller/Posts.pm b/lib/CF/Controller/Posts.pm index d4c67470ffe35128873487287818b19da793dbf0..2d9f09d452fdc9cb0d11a882c11f58154a549740 100644 --- a/lib/CF/Controller/Posts.pm +++ b/lib/CF/Controller/Posts.pm @@ -21,7 +21,7 @@ sub create ($c) { })->first; # Neni zadny aktivnibod rozpravy - if ( ! $program_entry ) { + if ( ! ( $program_entry && $program_entry->discussion_opened )) { return $c->error(403, 'Debate closed'); } diff --git a/lib/CF/Schema/Result/ProgramEntry.pm b/lib/CF/Schema/Result/ProgramEntry.pm index 8810b122df65c739a4dc5ec40e7daef5b75ba717..9e67019fba51c9e24f84e5c6a4632e8d3c63c490 100644 --- a/lib/CF/Schema/Result/ProgramEntry.pm +++ b/lib/CF/Schema/Result/ProgramEntry.pm @@ -22,6 +22,7 @@ __PACKAGE__->add_columns( finish is_approved is_live + discussion_opened title proposer description diff --git a/openapi.yaml b/openapi.yaml index d6331e6cde9c9d379d0dbe2eba00e8eee4395357..36a6bd51c768aa53e1d721eb27c1b662342d6e65 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -55,6 +55,8 @@ components: nullable: true is_live: type: boolean + discussion_opened: + type: boolean title: type: string proposer: diff --git a/sql/1/up.sql b/sql/1/up.sql index 957ecc7cc414d6581a4230e4620c6da35f4d196f..8917a501a3b049a7074a3a64e755f0d1bfa34879 100644 --- a/sql/1/up.sql +++ b/sql/1/up.sql @@ -7,6 +7,7 @@ create table "program" ( "finish" timestamp, "is_approved" bool not null default 'false', "is_live" bool not null default 'false', + "discussion_opened" bool not null default 'false', "title" text not null, "proposer" text, "description" text,