Let participants edit their open answer while voting is open
CI / Deploy / test (push) Successful in 1m4s
CI / Deploy / deploy (push) Skipped

Generalises the comment edit to /p/{code}/edit: open answers can be
corrected (not emptied), scale comments as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-11 11:59:54 +01:00
1 parent e6f52a0449
commit 51d1be8695
7 files changed
+135 -48

No files matched your search

@@ -267,7 +267,7 @@ class ScaleCommentsTest extends TestCase
$this->assertResponseContains('Kommentar bearbeiten');
$this->assertResponseContains('Sehr &lt;gut&gt;');
$this->post('/p/' . $poll->join_code . '/comment', ['slide_id' => $slide->id, 'comment' => ' Sehr gut! ', 'value' => '1']);
$this->post('/p/' . $poll->join_code . '/edit', ['slide_id' => $slide->id, 'comment' => ' Sehr gut! ', 'value' => '1']);
$this->assertRedirect('/p/' . $poll->join_code);
$this->assertFlashMessage('Dein Kommentar wurde gespeichert.');
@@ -279,8 +279,8 @@ class ScaleCommentsTest extends TestCase
$this->assertSame(4, $rows->first()->numeric_value, 'the rating stays unchanged');
// Repeating the request is harmless, an empty comment removes it.
$this->post('/p/' . $poll->join_code . '/comment', ['slide_id' => $slide->id, 'comment' => ' Sehr gut! ']);
$this->post('/p/' . $poll->join_code . '/comment', ['slide_id' => $slide->id, 'comment' => '']);
$this->post('/p/' . $poll->join_code . '/edit', ['slide_id' => $slide->id, 'comment' => ' Sehr gut! ']);
$this->post('/p/' . $poll->join_code . '/edit', ['slide_id' => $slide->id, 'comment' => '']);
$this->assertFlashMessage('Dein Kommentar wurde entfernt.');
$this->assertNull($this->slidesTable()->Responses->get($rows->first()->id)->text_value);
}
@@ -293,7 +293,7 @@ class ScaleCommentsTest extends TestCase
$this->get('/p/' . $poll->join_code);
$this->assertResponseContains('Kommentar hinzufügen');
$this->post('/p/' . $poll->join_code . '/comment', ['slide_id' => $slide->id, 'comment' => 'Nachgereicht']);
$this->post('/p/' . $poll->join_code . '/edit', ['slide_id' => $slide->id, 'comment' => 'Nachgereicht']);
$row = $this->slidesTable()->Responses->find()
->where(['slide_id' => $slide->id, 'participant_hash' => $this->hash('b', $poll)])
->firstOrFail();
@@ -309,7 +309,7 @@ class ScaleCommentsTest extends TestCase
$this->get('/p/' . $poll->join_code);
$this->assertResponseNotContains('Kommentar bearbeiten');
$this->post('/p/' . $poll->join_code . '/comment', ['slide_id' => $slide->id, 'comment' => 'Zu spät']);
$this->post('/p/' . $poll->join_code . '/edit', ['slide_id' => $slide->id, 'comment' => 'Zu spät']);
$this->assertFlashMessage('Die Abstimmung zu dieser Frage ist geschlossen.');
$this->assertSame('Sehr <gut>', $this->slidesTable()->Responses->find()
->where(['slide_id' => $slide->id, 'participant_hash' => $this->hash('a', $poll)])
@@ -322,7 +322,7 @@ class ScaleCommentsTest extends TestCase
$votes = new VoteService();
try {
$votes->editComment($poll, $slide, $this->hash('z', $poll), ['comment' => 'Ohne Bewertung']);
$votes->editText($poll, $slide, $this->hash('z', $poll), ['comment' => 'Ohne Bewertung']);
$this->fail('Expected VoteException');
} catch (VoteException $e) {
$this->assertSame('Bitte gib zuerst deine Bewertung ab.', $e->getMessage());
@@ -333,6 +333,6 @@ class ScaleCommentsTest extends TestCase
$poll = $this->goLive($poll, $plain);
$votes->submit($poll, $plain, $this->hash('a', $poll), ['value' => 3]);
$this->expectException(VoteException::class);
$votes->editComment($poll, $plain, $this->hash('a', $poll), ['comment' => 'Eingeschmuggelt']);
$votes->editText($poll, $plain, $this->hash('a', $poll), ['comment' => 'Eingeschmuggelt']);
}
}