Allow upvoting own Q&A questions as an opt-in setting
The new Q&A setting allow_self_upvote (off by default) lets participants spend their upvote budget on their own questions, e.g. for prioritizing topics. Without it, participants now see a short hint why their own questions cannot be upvoted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ec0b13cae8
commit
affc9a5ece
10 files changed
+59
-12
No files matched your search
@@ -284,11 +284,12 @@ class PollStateService
|
||||
* - collect: all questions so far in submission order (helps to avoid duplicates), `mine` marks own ones
|
||||
* - vote: all questions in submission order, without counts (no bandwagon effect)
|
||||
* - discuss: all questions ranked with upvotes, `focusId` = question being discussed
|
||||
* `upvoted` = own upvotes per question id (several per question are allowed).
|
||||
* `upvoted` = own upvotes per question id (several per question are allowed),
|
||||
* `allowSelfUpvote` = own questions may be upvoted too (setting `allow_self_upvote`).
|
||||
*
|
||||
* @param \App\Model\Entity\Slide $slide Q&A slide
|
||||
* @param string $participantHash Participant hash
|
||||
* @return array{stage: string, maxUpvotes: int, votesLeft: int, mine: list<int>, upvoted: array<int, int>,
|
||||
* @return array{stage: string, maxUpvotes: int, votesLeft: int, allowSelfUpvote: bool, mine: list<int>, upvoted: array<int, int>,
|
||||
* questions: list<array{id: int, text: string, votes?: int}>, focusId: int|null}
|
||||
*/
|
||||
public function qaState(Slide $slide, string $participantHash): array
|
||||
@@ -311,6 +312,7 @@ class PollStateService
|
||||
'stage' => $stage,
|
||||
'maxUpvotes' => $max,
|
||||
'votesLeft' => max(0, $max - count($own['upvotes'])),
|
||||
'allowSelfUpvote' => (bool)$slide->setting('allow_self_upvote'),
|
||||
'mine' => $own['questions'],
|
||||
'upvoted' => array_count_values($own['upvotes']),
|
||||
'questions' => array_values($questions),
|
||||
|
||||
Reference in new issue
Block a user