Merge pull request 'Remove dead code and validate new polls only once' (#33) from chore/remove-dead-code into main
Reviewed-on: #33
This commit was merged in pull request #33.
This commit is contained in:
commit
a62e13eeff
13 files changed
+78
-102
No files matched your search
@@ -72,8 +72,7 @@ class HomeController extends AppController
|
||||
$this->request->allowMethod(['post']);
|
||||
$captcha = CaptchaFactory::create('create');
|
||||
|
||||
$poll = $this->Polls->newEmptyEntity();
|
||||
$poll = $this->Polls->patchEntity($poll, (array)$this->request->getData(), ['fields' => ['title', 'email']]);
|
||||
$poll = $this->Polls->newPoll((array)$this->request->getData());
|
||||
|
||||
if ($this->isHoneypotFilled()) {
|
||||
$this->Flash->error(__('Die Umfrage konnte nicht angelegt werden.'));
|
||||
@@ -82,7 +81,7 @@ class HomeController extends AppController
|
||||
} elseif (!$poll->hasErrors() && !$this->throttle('create', 'Plenario.throttle.createPerHour')) {
|
||||
$this->Flash->error(__('Zu viele Umfragen in kurzer Zeit. Bitte versuche es später noch einmal.'));
|
||||
} elseif (!$poll->hasErrors()) {
|
||||
[$poll, $token] = $this->Polls->createPoll((array)$this->request->getData());
|
||||
[$poll, $token] = $this->Polls->insertPoll($poll);
|
||||
if ($token !== null) {
|
||||
$adminUrl = Router::url(['_name' => 'admin', 'token' => $token], true);
|
||||
$joinUrl = Router::url(['_name' => 'participate', 'code' => $poll->join_code], true);
|
||||
|
||||
@@ -41,7 +41,6 @@ class SlidesController extends AdminAppController
|
||||
$slide = $this->Slides->newEntity(['type' => $type, 'settings' => Slide::DEFAULT_SETTINGS[$type]], [
|
||||
'validate' => false,
|
||||
]);
|
||||
$slide->setNew(true);
|
||||
$slide->poll_id = $this->poll->id;
|
||||
// A quiz is started by the presenter (that also starts its timer).
|
||||
$slide->is_voting_open = $type !== Slide::TYPE_QUIZ;
|
||||
|
||||
Reference in new issue
Block a user