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

@@ -8216,6 +8216,226 @@
]
}
},
"/api/comments/{commentId}/poll/vote": {
"post": {
"description": "option: its index; null takes the vote back.",
"operationId": "CommentsController_votePoll",
"parameters": [
{
"name": "commentId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VotePollDto"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommandResultDto"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"401": {
"description": "Missing or rejected Pireon token",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"403": {
"description": "Not a member of the project (or not allowed)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"409": {
"description": "Someone changed it at the same time: retry",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"422": {
"description": "Business rule (e.g. a transition the workflow forbids)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
}
},
"security": [
{
"pireon-oauth": []
},
{
"pireon": []
}
],
"summary": "Vote in a comment's poll (members, viewers too)",
"tags": [
"Comments"
]
}
},
"/api/comments/{commentId}/poll/close": {
"post": {
"description": "With decide (default), the winner stays as a decision of the ticket.",
"operationId": "CommentsController_closePoll",
"parameters": [
{
"name": "commentId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClosePollDto"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommandResultDto"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"401": {
"description": "Missing or rejected Pireon token",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"403": {
"description": "Not a member of the project (or not allowed)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"409": {
"description": "Someone changed it at the same time: retry",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"422": {
"description": "Business rule (e.g. a transition the workflow forbids)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
}
},
"security": [
{
"pireon-oauth": []
},
{
"pireon": []
}
],
"summary": "Close a poll (whoever started it, or an admin)",
"tags": [
"Comments"
]
}
},
"/api/comments/{commentId}/resolution": {
"put": {
"description": "Whoever can change the ticket. A conclusion is added as a reply marked as a decision. The web folds a settled conversation.",
@@ -17618,6 +17838,48 @@
"users"
]
},
"PollOptionDto": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"voters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserRefDto"
}
}
},
"required": [
"text",
"voters"
]
},
"CommentPollDto": {
"type": "object",
"properties": {
"options": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PollOptionDto"
}
},
"closed": {
"type": "boolean"
},
"winner": {
"type": "number",
"nullable": true,
"description": "Index of the winning option once closed (null on a tie)"
}
},
"required": [
"options",
"closed",
"winner"
]
},
"CommentDto": {
"type": "object",
"properties": {
@@ -17672,6 +17934,15 @@
"nullable": true,
"format": "date-time"
},
"poll": {
"nullable": true,
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/CommentPollDto"
}
]
},
"resolved": {
"type": "boolean",
"description": "A conversation (top-level comment and its replies) that was settled"
@@ -17715,6 +17986,7 @@
"decision",
"decidedBy",
"decidedAt",
"poll",
"resolved",
"resolvedBy",
"resolvedAt",
@@ -17768,6 +18040,17 @@
"type": "string",
"format": "uuid",
"description": "Comment it answers (one level: answering a reply joins its thread)"
},
"poll": {
"description": "A quick poll: 2 to 6 options",
"example": [
"Stripe",
"Redsys"
],
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
@@ -17860,6 +18143,29 @@
"on"
]
},
"VotePollDto": {
"type": "object",
"properties": {
"option": {
"type": "number",
"nullable": true,
"description": "Option index; null takes the vote back"
}
},
"required": [
"option"
]
},
"ClosePollDto": {
"type": "object",
"properties": {
"decide": {
"type": "boolean",
"default": true,
"description": "Keep the winner as a decision of the ticket"
}
}
},
"ResolveThreadDto": {
"type": "object",
"properties": {

View File

@@ -304,6 +304,7 @@ type Comment {
editedAt: String
id: ID!
issueId: ID!
poll: CommentPoll
"""In the order they are offered; only the ones somebody chose"""
reactions: [CommentReaction!]!
@@ -336,6 +337,15 @@ type CommentPage {
total: Int!
}
"""A quick poll in a comment"""
type CommentPoll {
closed: Boolean!
options: [PollOption!]!
"""Index of the winning option once closed (null on a tie)"""
winner: Int
}
"""One emoji on a comment"""
type CommentReaction {
emoji: String!
@@ -964,7 +974,14 @@ type Mutation {
"""
Comment on a ticket, or answer a comment (replyTo; one level of replies)
"""
addComment(body: String!, issueId: ID!, replyTo: ID): CommandResult!
addComment(
body: String!
issueId: ID!
"""A quick poll: 2 to 6 options"""
poll: [String!]
replyTo: ID
): CommandResult!
"""
Add a repository with its own secret (the first turns the integration on)
@@ -1010,6 +1027,11 @@ type Mutation {
"""Drop my reminder on a ticket"""
clearReminder(issueId: ID!): Boolean!
"""
Close a poll (whoever started it, or an admin); with decide, the winner stays as a decision of the ticket
"""
closePoll(commentId: ID!, decide: Boolean! = true): CommandResult!
"""
Close the sprint under way. Unfinished tickets move to carryOverToSprintId, or back to the backlog when it is null.
"""
@@ -1233,6 +1255,11 @@ type Mutation {
"""
voteIssue(issueId: ID!, on: Boolean!): CommandResult!
"""
Vote in a comment's poll (option index), or take the vote back (null). Members, viewers too
"""
votePoll(commentId: ID!, option: Int): CommandResult!
"""
Follow a ticket: be told when it moves, is reassigned or gets a comment
"""
@@ -1373,6 +1400,11 @@ type OptionCount {
value: String!
}
type PollOption {
text: String!
voters: [UserRef!]!
}
"""
One of my active projects at a glance: open work, risks, sprint, releases and epics
"""