add: tags commiter message

This commit is contained in:
yystopf 2021-09-23 18:57:16 +08:00
parent 206bba1c49
commit bbcca413c6
5 changed files with 615 additions and 396 deletions

View File

@ -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"
}
}
}
]
```
## 编辑仓库信息
编辑仓库信息

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff