feat: quick polls in comments that end in a decision

«📊 Añadir una encuesta» adds 2 to 6 options to a new comment. Members,
viewers too, vote by clicking an option (one vote each, which they can
change or take back) and see each option's votes as a bar. Whoever
started it, or an admin, closes it with «Cerrar y decidir»: the most
voted wins (none on a tie) and a «Decidido: …» reply marked as a
decision shows above the ticket. Events of the comment (voted, closed).

API: addComment(…, poll), votePoll, closePoll, Comment.poll;
POST /api/comments/{id}/poll/vote and …/poll/close. MCP: add_comment
poll, vote_poll, close_poll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 20:48:12 +02:00
parent 93d028e870
commit 3a46a236e4
41 changed files with 2144 additions and 77 deletions

View File

@@ -612,6 +612,22 @@ export class CommentReactionDto {
@ApiProperty({ type: [UserRefDto] }) users!: UserRefDto[];
}
export class PollOptionDto {
@ApiProperty() text!: string;
@ApiProperty({ type: [UserRefDto] }) voters!: UserRefDto[];
}
export class CommentPollDto {
@ApiProperty({ type: [PollOptionDto] }) options!: PollOptionDto[];
@ApiProperty() closed!: boolean;
@ApiProperty({
type: Number,
nullable: true,
description: 'Index of the winning option once closed (null on a tie)',
})
winner!: number | null;
}
export class CommentDto {
@ApiProperty({ format: 'uuid' }) id!: string;
@ApiProperty({ format: 'uuid' }) issueId!: string;
@@ -648,6 +664,8 @@ export class CommentDto {
decidedBy!: UserRefDto | null;
@ApiProperty({ type: String, nullable: true, format: 'date-time' })
decidedAt!: string | null;
@ApiProperty({ type: CommentPollDto, nullable: true })
poll!: CommentPollDto | null;
@ApiProperty({
description:
'A conversation (top-level comment and its replies) that was settled',