1
0

feat: emoji reactions for tasks and comments (#2196)

This PR adds reactions for tasks and comments, similar to what you can do on Gitea, GitHub, Slack and plenty of other tools.

Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2196
Co-authored-by: kolaente <k@knt.li>
Co-committed-by: kolaente <k@knt.li>
This commit is contained in:
kolaente
2024-03-12 19:25:58 +00:00
committed by konrad
parent b9c513f681
commit a5c51d4b1e
43 changed files with 1653 additions and 37 deletions

View File

@ -7034,6 +7034,190 @@
}
}
},
"/{kind}/{id}/reactions": {
"get": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Returns all reactions for an entity",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Get all reactions for an entity",
"parameters": [
{
"type": "integer",
"description": "Entity ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "The kind of the entity. Can be either `tasks` or `comments` for task comments",
"name": "kind",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The reactions",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ReactionMap"
}
}
},
"403": {
"description": "The user does not have access to the entity",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
},
"put": {
"security": [
{
"JWTKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Add a reaction to an entity",
"parameters": [
{
"type": "integer",
"description": "Entity ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "The kind of the entity. Can be either `tasks` or `comments` for task comments",
"name": "kind",
"in": "path",
"required": true
},
{
"description": "The reaction you want to add to the entity.",
"name": "project",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.Reaction"
}
}
],
"responses": {
"200": {
"description": "The created reaction",
"schema": {
"$ref": "#/definitions/models.Reaction"
}
},
"403": {
"description": "The user does not have access to the entity",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
},
"delete": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Removes the reaction of that user on that entity.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"task"
],
"summary": "Removes the user's reaction",
"parameters": [
{
"type": "integer",
"description": "Entity ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "The kind of the entity. Can be either `tasks` or `comments` for task comments",
"name": "kind",
"in": "path",
"required": true
},
{
"description": "The reaction you want to add to the entity.",
"name": "project",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.Reaction"
}
}
],
"responses": {
"200": {
"description": "The reaction was successfully removed.",
"schema": {
"$ref": "#/definitions/models.Message"
}
},
"403": {
"description": "The user does not have access to the entity",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/{username}/avatar": {
"get": {
"description": "Returns the user avatar as image.",
@ -7746,6 +7930,36 @@
}
}
},
"models.Reaction": {
"type": "object",
"properties": {
"created": {
"description": "A timestamp when this reaction was created. You cannot change this value.",
"type": "string"
},
"user": {
"description": "The user who reacted",
"allOf": [
{
"$ref": "#/definitions/user.User"
}
]
},
"value": {
"description": "The actual reaction. This can be any valid utf character or text, up to a length of 20.",
"type": "string"
}
}
},
"models.ReactionMap": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/user.User"
}
}
},
"models.RelatedTaskMap": {
"type": "object",
"additionalProperties": {