Let participants withdraw their own word cloud terms
CI / Deploy / test (push) Successful in 59s
CI / Deploy / deploy (push) Skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-11 12:07:44 +01:00
1 parent 3a8962976e
commit ad5223906c
7 files changed
+154 -6

No files matched your search

+10 -2
View File
@@ -321,8 +321,8 @@ class PollStateService
*
* @param \App\Model\Entity\Slide $slide Word cloud slide
* @param string $participantHash Participant hash
* @return array{mine: list<string>, down: list<string>, allowUpvotes: bool, allowDownvotes: bool}
* `mine` (named/upvoted) and `down` are lower case word keys
* @return array{mine: list<string>, down: list<string>, own: list<array{text: string, down: bool}>, allowUpvotes: bool, allowDownvotes: bool}
* `mine` (named/upvoted) and `down` are lower case word keys, `own` the same entries as typed
*/
public function wordState(Slide $slide, string $participantHash): array
{
@@ -330,10 +330,18 @@ class PollStateService
$mine = array_values(array_unique(array_map(VoteService::wordKey(...), $votes['up'])));
$down = array_values(array_unique(array_map(VoteService::wordKey(...), $votes['down'])));
$allowUpvotes = (bool)$slide->setting('allow_upvotes');
// Own entries as typed (first spelling per key), oldest first, so they can be withdrawn.
$own = [];
foreach (['up' => false, 'down' => true] as $kind => $isDown) {
foreach ($votes[$kind] as $text) {
$own[VoteService::wordKey($text)] ??= ['text' => $text, 'down' => $isDown];
}
}
return [
'mine' => $mine,
'down' => $down,
'own' => array_values($own),
'allowUpvotes' => $allowUpvotes,
'allowDownvotes' => $allowUpvotes && (bool)$slide->setting('allow_downvotes'),
];