summaryrefslogtreecommitdiffstats
path: root/templates/swagger
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-05-25 15:17:19 +0200
committerGitHub <noreply@github.com>2023-05-25 15:17:19 +0200
commitaaa109466350c531b9238a61115b2877daca57d3 (patch)
tree4f5759d3591d6424d80e44e5b8ee97bdd0c7c9ac /templates/swagger
parent79087bdb2676ac383f4bd21137d4454f7a26c8c4 (diff)
downloadgitea-aaa109466350c531b9238a61115b2877daca57d3.tar.gz
gitea-aaa109466350c531b9238a61115b2877daca57d3.zip
Add the ability to pin Issues (#24406)
This adds the ability to pin important Issues and Pull Requests. You can also move pinned Issues around to change their Position. Resolves #2175. ## Screenshots ![grafik](https://user-images.githubusercontent.com/15185051/235123207-0aa39869-bb48-45c3-abe2-ba1e836046ec.png) ![grafik](https://user-images.githubusercontent.com/15185051/235123297-152a16ea-a857-451d-9a42-61f2cd54dd75.png) ![grafik](https://user-images.githubusercontent.com/15185051/235640782-cbfe25ec-6254-479a-a3de-133e585d7a2d.png) The Design was mostly copied from the Projects Board. ## Implementation This uses a new `pin_order` Column in the `issue` table. If the value is set to 0, the Issue is not pinned. If it's set to a bigger value, the value is the Position. 1 means it's the first pinned Issue, 2 means it's the second one etc. This is dived into Issues and Pull requests for each Repo. ## TODO - [x] You can currently pin as many Issues as you want. Maybe we should add a Limit, which is configurable. GitHub uses 3, but I prefer 6, as this is better for bigger Projects, but I'm open for suggestions. - [x] Pin and Unpin events need to be added to the Issue history. - [x] Tests - [x] Migration **The feature itself is currently fully working, so tester who may find weird edge cases are very welcome!** --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'templates/swagger')
-rw-r--r--templates/swagger/v1_json.tmpl268
1 files changed, 268 insertions, 0 deletions
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index 03a65184c3..15043e465f 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -6191,6 +6191,39 @@
}
}
},
+ "/repos/{owner}/{repo}/issues/pinned": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "List a repo's pinned issues",
+ "operationId": "repoListPinnedIssues",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/IssueList"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/issues/{index}": {
"get": {
"produces": [
@@ -7419,6 +7452,144 @@
}
}
},
+ "/repos/{owner}/{repo}/issues/{index}/pin": {
+ "post": {
+ "tags": [
+ "issue"
+ ],
+ "summary": "Pin an Issue",
+ "operationId": "pinIssue",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "format": "int64",
+ "description": "index of issue to pin",
+ "name": "index",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "delete": {
+ "tags": [
+ "issue"
+ ],
+ "summary": "Unpin an Issue",
+ "operationId": "unpinIssue",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "format": "int64",
+ "description": "index of issue to unpin",
+ "name": "index",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
+ "/repos/{owner}/{repo}/issues/{index}/pin/{position}": {
+ "patch": {
+ "tags": [
+ "issue"
+ ],
+ "summary": "Moves the Pin to the given Position",
+ "operationId": "moveIssuePin",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "format": "int64",
+ "description": "index of issue",
+ "name": "index",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "format": "int64",
+ "description": "the new position",
+ "name": "position",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/issues/{index}/reactions": {
"get": {
"consumes": [
@@ -9010,6 +9181,39 @@
}
}
},
+ "/repos/{owner}/{repo}/new_pin_allowed": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "Returns if new Issue Pins are allowed",
+ "operationId": "repoNewPinAllowed",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/RepoNewIssuePinsAllowed"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/notifications": {
"get": {
"consumes": [
@@ -9302,6 +9506,39 @@
}
}
},
+ "/repos/{owner}/{repo}/pulls/pinned": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "List a repo's pinned pull requests",
+ "operationId": "repoListPinnedPullRequests",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/PullRequestList"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/pulls/{index}": {
"get": {
"produces": [
@@ -18664,6 +18901,11 @@
"format": "int64",
"x-go-name": "OriginalAuthorID"
},
+ "pin_order": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "PinOrder"
+ },
"pull_request": {
"$ref": "#/definitions/PullRequestMeta"
},
@@ -19224,6 +19466,21 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "NewIssuePinsAllowed": {
+ "description": "NewIssuePinsAllowed represents an API response that says if new Issue Pins are allowed",
+ "type": "object",
+ "properties": {
+ "issues": {
+ "type": "boolean",
+ "x-go-name": "Issues"
+ },
+ "pull_requests": {
+ "type": "boolean",
+ "x-go-name": "PullRequests"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"NodeInfo": {
"description": "NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks",
"type": "object",
@@ -19934,6 +20191,11 @@
"type": "string",
"x-go-name": "PatchURL"
},
+ "pin_order": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "PinOrder"
+ },
"requested_reviewers": {
"type": "array",
"items": {
@@ -22176,6 +22438,12 @@
"$ref": "#/definitions/IssueConfigValidation"
}
},
+ "RepoNewIssuePinsAllowed": {
+ "description": "RepoNewIssuePinsAllowed",
+ "schema": {
+ "$ref": "#/definitions/NewIssuePinsAllowed"
+ }
+ },
"Repository": {
"description": "Repository",
"schema": {