From 7d419f1714b2a104fc2f87acdd4292c6e5df5f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Mon, 28 Dec 2020 14:02:52 +0100 Subject: [PATCH] Bugfix, version 1.0.0 --- .gitlab-ci.yml | 2 +- lib/CF/Controller/Posts.pm | 46 ++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 27ff00c..1ab3890 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ image: docker:19.03.1 variables: DOCKER_TLS_CERTDIR: "/certs" IMAGE_TAG: $CI_REGISTRY_IMAGE - IMAGE_VER: 0.11.0 + IMAGE_VER: 1.0.0 services: - docker:19.03.1-dind diff --git a/lib/CF/Controller/Posts.pm b/lib/CF/Controller/Posts.pm index 384b0bf..767a87a 100644 --- a/lib/CF/Controller/Posts.pm +++ b/lib/CF/Controller/Posts.pm @@ -175,28 +175,30 @@ sub update ($c) { if ( $update->{state} && $post->state != $update->{state} ) { my $announcement_type = STATUS_ANNOUNCEMENTS->{ $args->{state} }; - #TODO: do modelu - my $msg = $c->schema->resultset('Announcement')->from_template( - $announcement_type, - $post->user->name, - $post->content, - ); - - my $announcement = $c->schema->resultset('Announcement')->create({ - user_id => $c->user->{id}, - type => $announcement_type, - content => $msg, - }); - - # potrebujeme kvuli datumu - $announcement = $c->schema->resultset('Announcement')->find({ - id => $announcement->id - }); - - $pubsub->json('notify')->notify( notify => { - event => 'announcement_created', - payload => $announcement->format(), - }); + if ( $announcement_type ) { + #TODO: do modelu + my $msg = $c->schema->resultset('Announcement')->from_template( + $announcement_type, + $post->user->name, + $post->content, + ); + + my $announcement = $c->schema->resultset('Announcement')->create({ + user_id => $c->user->{id}, + type => $announcement_type, + content => $msg, + }); + + # potrebujeme kvuli datumu + $announcement = $c->schema->resultset('Announcement')->find({ + id => $announcement->id + }); + + $pubsub->json('notify')->notify( notify => { + event => 'announcement_created', + payload => $announcement->format(), + }); + } } $post->add_to_history({ -- GitLab