diff --git a/app/docs/slate/source/includes/_repositories.md b/app/docs/slate/source/includes/_repositories.md
index eaae10746..81dbe1441 100644
--- a/app/docs/slate/source/includes/_repositories.md
+++ b/app/docs/slate/source/includes/_repositories.md
@@ -274,6 +274,84 @@ await octokit.request('GET /api/yystopf/ceshi/detail.json')
}
```
+## 仓库标签列表
+仓库标签列表
+
+> 示例:
+
+```shell
+curl -X GET http://localhost:3000/api/yystopf/csfjkkj/tags.json
+```
+
+```javascript
+await octokit.request('GET /api/yystopf/csfjkkj/tags.json')
+```
+
+### HTTP 请求
+`GET /api/:owner/:repo/tags.json`
+
+### 请求参数:
+参数 | 必选 | 默认 | 类型 | 字段说明
+--------- | ------- | ------- | -------- | ----------
+|owner |是| |string |用户登录名 |
+|repo |是| |string |项目标识identifier |
+
+
+### 返回字段说明:
+参数 | 类型 | 字段说明
+--------- | ----------- | -----------
+|id |int |标签id |
+|name |string|标签名称|
+|zipball_url |string|标签zip包下载地址|
+|tarball_url |string|标签tar包下载地址|
+|commit |object|标签最后一个commit|
+|commit.sha |string|commit的id|
+|commit.message |string|commit的提交信息|
+|commit.time_ago|string|commit的提交时间|
+|commit.commiter|object|commit的提交者|
+
+
+> 返回的JSON示例:
+
+```json
+[
+ {
+ "name": "v2.0.0",
+ "id": "c7d0873ee41796d1a0e193063095ccf539a9bf31",
+ "zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip",
+ "tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz",
+ "commit": {
+ "sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7",
+ "message": "add\n",
+ "time_ago": "4小时前",
+ "committer": {
+ "id": 4,
+ "login": "testforge1",
+ "name": "testforge1",
+ "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
+ }
+ }
+ },
+ {
+ "name": "v1.0.0",
+ "id": "12168ad39c3ef201a445a2db181a3e43d50e40dd",
+ "zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip",
+ "tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz",
+ "commit": {
+ "sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf",
+ "message": "ADD file via upload\n",
+ "time_ago": "9天前",
+ "committer": {
+ "id": 2,
+ "login": "yystopf",
+ "name": "heh",
+ "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
+ }
+ }
+ }
+]
+```
+
## 编辑仓库信息
编辑仓库信息
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 72f3f3415..c37fd59da 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -434,6 +434,10 @@ module ApplicationHelper
User.find_by_login login
end
+ def find_user_by_login_and_mail(login, mail)
+ User.find_by(login: login, mail: mail)
+ end
+
def find_user_by_gitea_uid(gitea_uid)
User.find_by(gitea_uid: gitea_uid)
end
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index d9679cb80..ee60b64a4 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -30,8 +30,8 @@ module RepositoriesHelper
if author_json["id"].present?
return find_user_by_gitea_uid author_json['id']
end
- if author_json["id"].nil? && author_json["name"].present?
- return find_user_by_login author_json['name']
+ if author_json["id"].nil? && (author_json["name"].present? && author_json["email"].present?)
+ return find_user_by_login_and_mail(author_json['name'], author_json["email"])
end
end
diff --git a/app/views/repositories/tags.json.jbuilder b/app/views/repositories/tags.json.jbuilder
index 9db3ff93e..011fad46a 100644
--- a/app/views/repositories/tags.json.jbuilder
+++ b/app/views/repositories/tags.json.jbuilder
@@ -6,6 +6,11 @@ json.array! @tags do |tag|
json.tarball_url render_tar_url(@owner, @repository, tag['name'])
json.commit do
json.sha tag['commit']['sha']
+ json.message tag['commit_message']
+ json.time_ago time_from_now(tag['commit_time'].to_time)
+ json.committer do
+ json.partial! 'commit_author', user: render_commit_author(tag['commiter']), name: tag['commiter']['name']
+ end
end
end
end
diff --git a/public/docs/api.html b/public/docs/api.html
index 4ec491b4f..763134f4e 100644
--- a/public/docs/api.html
+++ b/public/docs/api.html
@@ -469,6 +469,9 @@
仓库详情(新版)
+
+ 仓库标签列表
+
编辑仓库信息
@@ -6185,6 +6188,135 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
"Shell": "0.1%"
}
}
+仓库标签列表
+仓库标签列表
+
+
+示例:
+
+curl -X GET http://localhost:3000/api/yystopf/csfjkkj/tags.json
+
await octokit.request('GET /api/yystopf/csfjkkj/tags.json')
+
HTTP 请求
+GET /api/:owner/:repo/tags.json
+请求参数:
+
+
+| 参数 |
+必选 |
+默认 |
+类型 |
+字段说明 |
+
+
+
+| owner |
+是 |
+ |
+string |
+用户登录名 |
+
+
+| repo |
+是 |
+ |
+string |
+项目标识identifier |
+
+
+返回字段说明:
+
+
+| 参数 |
+类型 |
+字段说明 |
+
+
+
+| id |
+int |
+标签id |
+
+
+| name |
+string |
+标签名称 |
+
+
+| zipball_url |
+string |
+标签zip包下载地址 |
+
+
+| tarball_url |
+string |
+标签tar包下载地址 |
+
+
+| commit |
+object |
+标签最后一个commit |
+
+
+| commit.sha |
+string |
+commit的id |
+
+
+| commit.message |
+string |
+commit的提交信息 |
+
+
+| commit.time_ago |
+string |
+commit的提交时间 |
+
+
+| commit.commiter |
+object |
+commit的提交者 |
+
+
+
+
+返回的JSON示例:
+
+[
+ {
+ "name": "v2.0.0",
+ "id": "c7d0873ee41796d1a0e193063095ccf539a9bf31",
+ "zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip",
+ "tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz",
+ "commit": {
+ "sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7",
+ "message": "add\n",
+ "time_ago": "4小时前",
+ "committer": {
+ "id": 4,
+ "login": "testforge1",
+ "name": "testforge1",
+ "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
+ }
+ }
+ },
+ {
+ "name": "v1.0.0",
+ "id": "12168ad39c3ef201a445a2db181a3e43d50e40dd",
+ "zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip",
+ "tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz",
+ "commit": {
+ "sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf",
+ "message": "ADD file via upload\n",
+ "time_ago": "9天前",
+ "committer": {
+ "id": 2,
+ "login": "yystopf",
+ "name": "heh",
+ "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
+ }
+ }
+ }
+]
编辑仓库信息
编辑仓库信息
@@ -6193,9 +6325,9 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
curl -X GET http://localhost:3000/api/jasder/jasder_test/edit.json
await octokit.request('GET /api/jasder/jasder_test/edit.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/edit.json
-请求参数:
+请求参数:
| 参数 |
@@ -6220,7 +6352,7 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
项目标识identifier |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -6297,9 +6429,9 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
-d "private=true" \
http://localhost:3000/api/jasder/jasder_test.json
await octokit.request('PATCH /api/jasder/jasder_test.json')
-
HTTP 请求
+HTTP 请求
PATCH /api/:owner/:repo
-请求参数:
+请求参数:
| 参数 |
@@ -6359,7 +6491,7 @@ http://localhost:3000/api/jasder/jasder_test.json
项目是否私有, true:为私有,false: 公开,默认为公开 |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -6424,9 +6556,9 @@ http://localhost:3000/api/jasder/jasder_test.json
curl -X DELETE http://localhost:3000/api/jasder/jasder_test.json
await octokit.request('DELETE /api/jasder/jasder_test.json')
-
HTTP 请求
+HTTP 请求
PATCH /api/:owner/:repo
-请求参数:
+请求参数:
| 参数 |
@@ -6451,7 +6583,7 @@ http://localhost:3000/api/jasder/jasder_test.json
项目标识identifier |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -6492,9 +6624,9 @@ http://localhost:3000/api/jasder/jasder_test.json
-d "user_id=12" \
http://localhost:3000/api/jasder/jasder_test/collaborators.json
await octokit.request('POST /api/jasder/jasder_test/collaborators.json')
-
HTTP 请求
+HTTP 请求
POST /api/:owner/:repo/collaborators.json
-请求参数:
+请求参数:
| 参数 |
@@ -6526,7 +6658,7 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
用户id |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -6567,9 +6699,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
-d "user_id=12" \
http://localhost:3000/api/jasder/jasder_test/collaborators.json
await octokit.request('DELETE /api/jasder/jasder_test/collaborators.json')
-
HTTP 请求
+HTTP 请求
DELETE /api/:owner/:repo/collaborators.json
-请求参数:
+请求参数:
| 参数 |
@@ -6601,7 +6733,7 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
用户id |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -6643,9 +6775,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
-d "role=Developer" \
http://localhost:3000/api/jasder/jasder_test/change_role.json
await octokit.request('PUT /api/jasder/jasder_test/change_role.json')
-
HTTP 请求
+HTTP 请求
PUT /api/:owner/:repo/change_role.json
-请求参数:
+请求参数:
| 参数 |
@@ -6684,7 +6816,7 @@ http://localhost:3000/api/jasder/jasder_test/change_role.json
取值范围:"Manager", "Developer", "Reporter";分别为项目管理人员(拥有所有操作权限)、项目开发人员(只拥有读写权限)、项目报告人员(只拥有读权限) |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -6726,9 +6858,9 @@ http://localhost:3000/api/jasder/jasder_test/change_role.json
-d "limit=5" \
http://localhost:3000/api/jasder/jasder_test/collaborators.json
await octokit.request('GET /api/jasder/jasder_test/collaborators.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/collaborators.json
-请求参数:
+请求参数:
| 参数 |
@@ -6767,7 +6899,7 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
每页多少条数据,默认15条 |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -6855,9 +6987,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
-d "ref=develop" \
http://localhost:3000/api/yystopf/ceshi/files.json
await octokit.request('GET /api/yystopf/ceshi/files.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/files
-请求参数:
+请求参数:
| 参数 |
@@ -6896,7 +7028,7 @@ http://localhost:3000/api/yystopf/ceshi/files.json
分支名,默认为仓库默认分支 |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -6978,9 +7110,9 @@ http://localhost:3000/api/yystopf/ceshi/files.json
-d "ref=develop" \
http://localhost:3000//api/jasder/jasder_test/entries.json
await octokit.request('GET /api/jasder/jasder_test/entries.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/entries.json
-请求参数:
+请求参数:
| 参数 |
@@ -7012,7 +7144,7 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
分支名称、tag名称或是提交记录id,默认为master分支 |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -7126,9 +7258,9 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
-d "filepath=file" \
http://localhost:3000//api/jasder/jasder_test/sub_entries.json
await octokit.request('GET /api/jasder/jasder_test/sub_entries.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/sub_entries.json
-请求参数:
+请求参数:
| 参数 |
@@ -7167,7 +7299,7 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
分支名称、tag名称或是提交记录id,默认为master分支 |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -7264,9 +7396,9 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
-d "filepath=lib" \
http://localhost:3000/api/yystopf/csfjkkj/readme.json
await octokit.request('GET /api/yystopf/csfjkkj/readme.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/readme.json
-请求参数:
+请求参数:
| 参数 |
@@ -7305,7 +7437,7 @@ http://localhost:3000/api/yystopf/csfjkkj/readme.json
子目录名称,默认为空 |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -7377,9 +7509,9 @@ http://localhost:3000/api/yystopf/csfjkkj/readme.json
-d "filepath=lib" \
http://localhost:3000/api/yystopf/csfjkkj/contributors.json
await octokit.request('GET /api/yystopf/csfjkkj/contributors.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/contributors.json
-请求参数:
+请求参数:
| 参数 |
@@ -7418,7 +7550,7 @@ http://localhost:3000/api/yystopf/csfjkkj/contributors.json
子目录名称,默认为空 |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -7493,9 +7625,9 @@ http://localhost:3000/api/yystopf/csfjkkj/contributors.json
curl -X GET \
http://localhost:3000/api/yystopf/ceshi/webhooks.json
await octokit.request('GET /api/yystopf/ceshi/webhooks.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/webhooks.json
-请求参数:
+请求参数:
| 参数 |
@@ -7520,7 +7652,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
项目标识identifier |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -7622,9 +7754,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
curl -X GET \
http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
await octokit.request('GET /api/yystopf/ceshi/webhooks/3/edit.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/webhooks/:id/edit.json
-请求参数:
+请求参数:
| 参数 |
@@ -7656,7 +7788,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
webhook ID |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -7857,9 +7989,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
curl -X POST \
http://localhost:3000/api/yystopf/ceshi/webhooks.json
await octokit.request('POST /api/yystopf/ceshi/webhooks.json')
-
HTTP 请求
+HTTP 请求
POST /api/:owner/:repo/webhooks.json
-请求参数:
+请求参数:
| 参数 |
@@ -8043,7 +8175,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
"branch_filter": "*",
"events": ["push"]
}
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -8115,9 +8247,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
curl -X PATCH \
http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
await octokit.request('PATCH /api/yystopf/ceshi/webhooks/7.json')
-
HTTP 请求
+HTTP 请求
PATCH /api/:owner/:repo/webhooks/:id.json
-请求参数:
+请求参数:
| 参数 |
@@ -8308,7 +8440,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
"branch_filter": "*",
"events": ["push"]
}
-返回字段说明:
+返回字段说明:
返回的JSON示例:
@@ -8329,9 +8461,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
curl -X DELETE \
http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
await octokit.request('DELETE /api/yystopf/ceshi/webhooks/7.json')
-
HTTP 请求
+HTTP 请求
DELETE /api/:owner/:repo/webhooks/:id.json
-请求参数:
+请求参数:
| 参数 |
@@ -8363,7 +8495,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
webhook id |
-返回字段说明:
+返回字段说明:
返回的JSON示例:
@@ -8384,9 +8516,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
curl -X GET \
http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
await octokit.request('GET /api/yystopf/ceshi/webhooks/3/tasks.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/webhooks/:id/tasks.json
-请求参数:
+请求参数:
| 参数 |
@@ -8418,7 +8550,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
webhook ID |
-返回字段说明:
+返回字段说明:
| 参数 |
@@ -8655,9 +8787,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
curl -X POST \
http://localhost:3000/api/yystopf/ceshi/webhooks/3/test.json
await octokit.request('POST /api/yystopf/ceshi/webhooks/3/test.json')
-
HTTP 请求
+HTTP 请求
POST /api/:owner/:repo/webhooks/:id/test.json
-请求参数:
+请求参数:
| 参数 |
@@ -8689,7 +8821,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/test.json
webhook ID |
-返回字段说明:
+返回字段说明:
返回的JSON示例: