fix: tag addition message

This commit is contained in:
yystopf 2021-09-24 18:06:29 +08:00
parent bbcca413c6
commit 33473eecc2
4 changed files with 107 additions and 14 deletions

View File

@ -4,7 +4,7 @@ class ProjectsController < ApplicationController
include ProjectsHelper include ProjectsHelper
include Acceleratorable include Acceleratorable
before_action :require_login, except: %i[index branches group_type_list simple show fork_users praise_users watch_users recommend about menu_list] before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend about menu_list]
before_action :require_profile_completed, only: [:create, :migrate] before_action :require_profile_completed, only: [:create, :migrate]
before_action :load_repository, except: %i[index group_type_list migrate create recommend] before_action :load_repository, except: %i[index group_type_list migrate create recommend]
before_action :authorizate_user_can_edit_project!, only: %i[update] before_action :authorizate_user_can_edit_project!, only: %i[update]

View File

@ -295,6 +295,8 @@ await octokit.request('GET /api/yystopf/csfjkkj/tags.json')
--------- | ------- | ------- | -------- | ---------- --------- | ------- | ------- | -------- | ----------
|owner |是| |string |用户登录名 | |owner |是| |string |用户登录名 |
|repo |是| |string |项目标识identifier | |repo |是| |string |项目标识identifier |
|page |否| 1 | integer | 页码 |
|limit |否| 20| integer | 每页个数 |
### 返回字段说明: ### 返回字段说明:
@ -304,11 +306,14 @@ await octokit.request('GET /api/yystopf/csfjkkj/tags.json')
|name |string|标签名称| |name |string|标签名称|
|zipball_url |string|标签zip包下载地址| |zipball_url |string|标签zip包下载地址|
|tarball_url |string|标签tar包下载地址| |tarball_url |string|标签tar包下载地址|
|tagger |object|打标签的人|
|message |string|标签信息|
|commit |object|标签最后一个commit| |commit |object|标签最后一个commit|
|commit.sha |string|commit的id| |commit.sha |string|commit的id|
|commit.message |string|commit的提交信息| |commit.message |string|commit的提交信息|
|commit.time_ago|string|commit的提交时间| |commit.time_ago|string|commit的提交时间|
|commit.commiter|object|commit的提交者| |commit.commiter|object|commit的提交者|
|commit.author|object|commit的作者|
> 返回的JSON示例: > 返回的JSON示例:
@ -320,15 +325,28 @@ await octokit.request('GET /api/yystopf/csfjkkj/tags.json')
"id": "c7d0873ee41796d1a0e193063095ccf539a9bf31", "id": "c7d0873ee41796d1a0e193063095ccf539a9bf31",
"zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip", "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", "tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz",
"tagger": {
"id": 4,
"login": "testforge1",
"name": "testforge1",
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
},
"message": "jdfkls",
"commit": { "commit": {
"sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7", "sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7",
"message": "add\n", "message": "add\n",
"time_ago": "4小时前", "time_ago": "1天前",
"committer": { "committer": {
"id": 4, "id": 4,
"login": "testforge1", "login": "testforge1",
"name": "testforge1", "name": "testforge1",
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png" "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
},
"author": {
"id": 4,
"login": "testforge1",
"name": "testforge1",
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
} }
} }
}, },
@ -337,15 +355,28 @@ await octokit.request('GET /api/yystopf/csfjkkj/tags.json')
"id": "12168ad39c3ef201a445a2db181a3e43d50e40dd", "id": "12168ad39c3ef201a445a2db181a3e43d50e40dd",
"zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip", "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", "tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz",
"tagger": {
"id": null,
"login": "viletyy",
"name": "viletyy",
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
},
"message": "dfks",
"commit": { "commit": {
"sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf", "sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf",
"message": "ADD file via upload\n", "message": "ADD file via upload\n",
"time_ago": "9天前", "time_ago": "21天前",
"committer": { "committer": {
"id": 2, "id": null,
"login": "yystopf", "login": "yystopf",
"name": "heh", "name": "yystopf",
"image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png" "image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
},
"author": {
"id": null,
"login": "yystopf",
"name": "yystopf",
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
} }
} }
} }

View File

@ -4,12 +4,19 @@ json.array! @tags do |tag|
json.id tag['id'] json.id tag['id']
json.zipball_url render_zip_url(@owner, @repository, tag['name']) json.zipball_url render_zip_url(@owner, @repository, tag['name'])
json.tarball_url render_tar_url(@owner, @repository, tag['name']) json.tarball_url render_tar_url(@owner, @repository, tag['name'])
json.tagger do
json.partial! 'commit_author', user: render_commit_author(tag['tagger']), name: tag['tagger']['name']
end
json.message tag['message']
json.commit do json.commit do
json.sha tag['commit']['sha'] json.sha tag['commit']['sha']
json.message tag['commit_message'] json.message tag['commit']['message']
json.time_ago time_from_now(tag['commit_time'].to_time) json.time_ago time_from_now(tag['commit']['commiter']['date'].to_time)
json.committer do json.committer do
json.partial! 'commit_author', user: render_commit_author(tag['commiter']), name: tag['commiter']['name'] json.partial! 'commit_author', user: render_commit_author(tag['commit']['commiter']), name: tag['commit']['commiter']['name']
end
json.author do
json.partial! 'commit_author', user: render_commit_author(tag['commit']['author']), name: tag['commit']['author']['name']
end end
end end
end end

View File

@ -6222,6 +6222,20 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
<td>string</td> <td>string</td>
<td>项目标识identifier</td> <td>项目标识identifier</td>
</tr> </tr>
<tr>
<td>page</td>
<td></td>
<td>1</td>
<td>integer</td>
<td>页码</td>
</tr>
<tr>
<td>limit</td>
<td></td>
<td>20</td>
<td>integer</td>
<td>每页个数</td>
</tr>
</tbody></table> </tbody></table>
<h3 id='7447e4874e-4'>返回字段说明:</h3> <h3 id='7447e4874e-4'>返回字段说明:</h3>
<table><thead> <table><thead>
@ -6252,6 +6266,16 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
<td>标签tar包下载地址</td> <td>标签tar包下载地址</td>
</tr> </tr>
<tr> <tr>
<td>tagger</td>
<td>object</td>
<td>打标签的人</td>
</tr>
<tr>
<td>message</td>
<td>string</td>
<td>标签信息</td>
</tr>
<tr>
<td>commit</td> <td>commit</td>
<td>object</td> <td>object</td>
<td>标签最后一个commit</td> <td>标签最后一个commit</td>
@ -6276,6 +6300,11 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
<td>object</td> <td>object</td>
<td>commit的提交者</td> <td>commit的提交者</td>
</tr> </tr>
<tr>
<td>commit.author</td>
<td>object</td>
<td>commit的作者</td>
</tr>
</tbody></table> </tbody></table>
<blockquote> <blockquote>
@ -6287,15 +6316,28 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"c7d0873ee41796d1a0e193063095ccf539a9bf31"</span><span class="p">,</span><span class="w"> </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"c7d0873ee41796d1a0e193063095ccf539a9bf31"</span><span class="p">,</span><span class="w">
</span><span class="nl">"zipball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip"</span><span class="p">,</span><span class="w"> </span><span class="nl">"zipball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tarball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz"</span><span class="p">,</span><span class="w"> </span><span class="nl">"tarball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tagger"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/T/19_237_174/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"jdfkls"</span><span class="p">,</span><span class="w">
</span><span class="nl">"commit"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nl">"commit"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"sha"</span><span class="p">:</span><span class="w"> </span><span class="s2">"08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7"</span><span class="p">,</span><span class="w"> </span><span class="nl">"sha"</span><span class="p">:</span><span class="w"> </span><span class="s2">"08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7"</span><span class="p">,</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"add</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span><span class="w"> </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"add</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span><span class="w">
</span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"4小时前"</span><span class="p">,</span><span class="w"> </span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1天前"</span><span class="p">,</span><span class="w">
</span><span class="nl">"committer"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nl">"committer"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w"> </span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w"> </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/T/19_237_174/120.png"</span><span class="w"> </span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/T/19_237_174/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"author"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/T/19_237_174/120.png"</span><span class="w">
</span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="p">},</span><span class="w"> </span><span class="p">},</span><span class="w">
@ -6304,15 +6346,28 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"12168ad39c3ef201a445a2db181a3e43d50e40dd"</span><span class="p">,</span><span class="w"> </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"12168ad39c3ef201a445a2db181a3e43d50e40dd"</span><span class="p">,</span><span class="w">
</span><span class="nl">"zipball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip"</span><span class="p">,</span><span class="w"> </span><span class="nl">"zipball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tarball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz"</span><span class="p">,</span><span class="w"> </span><span class="nl">"tarball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tagger"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"viletyy"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"viletyy"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/V/39_141_222/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dfks"</span><span class="p">,</span><span class="w">
</span><span class="nl">"commit"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nl">"commit"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"sha"</span><span class="p">:</span><span class="w"> </span><span class="s2">"5291b5e45a377c1f7710cc6647259887ed7aaccf"</span><span class="p">,</span><span class="w"> </span><span class="nl">"sha"</span><span class="p">:</span><span class="w"> </span><span class="s2">"5291b5e45a377c1f7710cc6647259887ed7aaccf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ADD file via upload</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span><span class="w"> </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ADD file via upload</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span><span class="w">
</span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"9天前"</span><span class="p">,</span><span class="w"> </span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"21天前"</span><span class="p">,</span><span class="w">
</span><span class="nl">"committer"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nl">"committer"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w"> </span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"heh"</span><span class="p">,</span><span class="w"> </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/H/188_239_142/120.png"</span><span class="w"> </span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/Y/241_125_89/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"author"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/Y/241_125_89/120.png"</span><span class="w">
</span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w">