From 672df5165c416c796ea6e0da76f1f048005e3f16 Mon Sep 17 00:00:00 2001 From: Phablulo Date: Mon, 27 Dec 2021 15:25:20 -0300 Subject: [PATCH] [PLUGIN][AttachmentCollections] Fixing forms submission --- plugins/AttachmentCollections/AttachmentCollections.php | 3 +++ plugins/AttachmentCollections/Controller/Controller.php | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/plugins/AttachmentCollections/AttachmentCollections.php b/plugins/AttachmentCollections/AttachmentCollections.php index eb7f12d32a..2e81e124ea 100644 --- a/plugins/AttachmentCollections/AttachmentCollections.php +++ b/plugins/AttachmentCollections/AttachmentCollections.php @@ -33,6 +33,7 @@ namespace Plugin\AttachmentCollections; use App\Core\DB\DB; use App\Core\Event; +use App\Core\Exception\RedirectException; use App\Core\Form; use function App\Core\I18n\_m; use App\Core\Modules\Plugin; @@ -172,6 +173,7 @@ class AttachmentCollections extends Plugin } } DB::flush(); + throw new RedirectException(); } // add to new collection form $create_form = Form::create([ @@ -204,6 +206,7 @@ class AttachmentCollections extends Plugin 'collection_id' => $coll->getId(), ])); DB::flush(); + throw new RedirectException(); } $res[] = Formatting::twigRenderFile( diff --git a/plugins/AttachmentCollections/Controller/Controller.php b/plugins/AttachmentCollections/Controller/Controller.php index 87e7814c89..9da6159db3 100644 --- a/plugins/AttachmentCollections/Controller/Controller.php +++ b/plugins/AttachmentCollections/Controller/Controller.php @@ -24,6 +24,7 @@ declare(strict_types = 1); namespace Plugin\AttachmentCollections\Controller; use App\Core\DB\DB; +use App\Core\Exception\RedirectException; use App\Core\Form; use function App\Core\I18n\_m; use App\Core\Router\Router; @@ -86,6 +87,7 @@ class Controller extends FeedController 'actor_id' => $id, ])); DB::flush(); + throw new RedirectException(); } } @@ -150,6 +152,7 @@ class Controller extends FeedController $collection->setName($edit->getData()['name']); DB::persist($collection); DB::flush(); + throw new RedirectException(); } return $edit->createView(); } @@ -169,6 +172,7 @@ class Controller extends FeedController if ($rm->isSubmitted()) { DB::remove($collection); DB::flush(); + throw new RedirectException(); } return $rm->createView(); }