Show scale comments only in the presentation
CI / Deploy / test (push) Successful in 49s
CI / Deploy / deploy (push) Skipped

Participants still see distribution and average (if enabled), but the
comments are emptied in their state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-08 15:54:34 +01:00
1 parent 9b879ca177
commit d6166bd9d9
5 files changed
+42 -12

No files matched your search

@@ -13,7 +13,7 @@ use Cake\TestSuite\IntegrationTestTrait;
use Cake\TestSuite\TestCase;
/**
* Scale slides with an optional comment field: comments rotate on the results unless the scale is private.
* Scale slides with an optional comment field: comments rotate in the presentation unless the scale is private.
*/
class ScaleCommentsTest extends TestCase
{
@@ -144,20 +144,32 @@ class ScaleCommentsTest extends TestCase
$this->assertSame([4, 3], array_column($results['comments'], 'value'));
}
public function testParticipantsSeeCommentsOnlyWithPublicResults(): void
public function testParticipantsNeverSeeComments(): void
{
[$poll] = $this->scaleWithComments();
// Participant "a" has already rated.
$this->assertTrue($poll->show_results_to_participants);
// Participant "a" has already rated and sees the results – but not the comments.
$this->cookie('plenario_pid', str_repeat('a', 32));
$this->get('/p/' . $poll->join_code . '/state');
$state = json_decode((string)$this->_response->getBody(), true);
$this->assertCount(2, $state['results']['comments']);
$this->assertNotEmpty($state['results']['buckets']);
$this->assertSame([], $state['results']['comments']);
$this->assertResponseNotContains('Zu lang');
$poll->show_results_to_participants = false;
$this->pollsTable()->saveOrFail($poll);
$this->get('/p/' . $poll->join_code . '/state');
$this->assertNull(json_decode((string)$this->_response->getBody(), true)['results']);
$this->get('/p/' . $poll->join_code);
$this->assertResponseNotContains('Zu lang');
}
public function testEmbedShowsComments(): void
{
[$poll, , $slide] = $this->scaleWithComments();
$key = $this->pollsTable()->ensureEmbedKey($poll);
$this->get("/e/$key/{$slide->id}/state");
$state = json_decode((string)$this->_response->getBody(), true);
$this->assertCount(2, $state['results']['comments']);
}
public function testPrivateScaleNeverShowsComments(): void