From fd6f4427b1f52c43e536380d1a8382a04fd6594d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Sun, 20 Dec 2020 00:08:55 +0100 Subject: [PATCH] Nepovolime pridavat zpravy do neotevrene dizkuse --- lib/CF/Controller/Posts.pm | 2 +- lib/CF/Schema/Result/ProgramEntry.pm | 1 + openapi.yaml | 2 ++ sql/1/up.sql | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CF/Controller/Posts.pm b/lib/CF/Controller/Posts.pm index d4c6747..2d9f09d 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 8810b12..9e67019 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 d6331e6..36a6bd5 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 957ecc7..8917a50 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, -- GitLab