From 33473eecc27b34a3df0a70b0eef1712b4c00f7f8 Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 24 Sep 2021 18:06:29 +0800 Subject: [PATCH] fix: tag addition message --- app/controllers/projects_controller.rb | 2 +- .../slate/source/includes/_repositories.md | 41 ++++++++++-- app/views/repositories/tags.json.jbuilder | 13 +++- public/docs/api.html | 65 +++++++++++++++++-- 4 files changed, 107 insertions(+), 14 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b19d2b633..bea2b429c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -4,7 +4,7 @@ class ProjectsController < ApplicationController include ProjectsHelper 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 :load_repository, except: %i[index group_type_list migrate create recommend] before_action :authorizate_user_can_edit_project!, only: %i[update] diff --git a/app/docs/slate/source/includes/_repositories.md b/app/docs/slate/source/includes/_repositories.md index 81dbe1441..1ebb45361 100644 --- a/app/docs/slate/source/includes/_repositories.md +++ b/app/docs/slate/source/includes/_repositories.md @@ -295,6 +295,8 @@ await octokit.request('GET /api/yystopf/csfjkkj/tags.json') --------- | ------- | ------- | -------- | ---------- |owner |是| |string |用户登录名 | |repo |是| |string |项目标识identifier | +|page |否| 1 | integer | 页码 | +|limit |否| 20| integer | 每页个数 | ### 返回字段说明: @@ -304,11 +306,14 @@ await octokit.request('GET /api/yystopf/csfjkkj/tags.json') |name |string|标签名称| |zipball_url |string|标签zip包下载地址| |tarball_url |string|标签tar包下载地址| +|tagger |object|打标签的人| +|message |string|标签信息| |commit |object|标签最后一个commit| |commit.sha |string|commit的id| |commit.message |string|commit的提交信息| |commit.time_ago|string|commit的提交时间| |commit.commiter|object|commit的提交者| +|commit.author|object|commit的作者| > 返回的JSON示例: @@ -320,15 +325,28 @@ await octokit.request('GET /api/yystopf/csfjkkj/tags.json') "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", + "tagger": { + "id": 4, + "login": "testforge1", + "name": "testforge1", + "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png" + }, + "message": "jdfkls", "commit": { "sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7", "message": "add\n", - "time_ago": "4小时前", + "time_ago": "1天前", "committer": { "id": 4, "login": "testforge1", "name": "testforge1", "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", "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", + "tagger": { + "id": null, + "login": "viletyy", + "name": "viletyy", + "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png" + }, + "message": "dfks", "commit": { "sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf", "message": "ADD file via upload\n", - "time_ago": "9天前", + "time_ago": "21天前", "committer": { - "id": 2, + "id": null, "login": "yystopf", - "name": "heh", - "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png" + "name": "yystopf", + "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" } } } diff --git a/app/views/repositories/tags.json.jbuilder b/app/views/repositories/tags.json.jbuilder index 011fad46a..8ae5f94cd 100644 --- a/app/views/repositories/tags.json.jbuilder +++ b/app/views/repositories/tags.json.jbuilder @@ -4,12 +4,19 @@ json.array! @tags do |tag| json.id tag['id'] json.zipball_url render_zip_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.sha tag['commit']['sha'] - json.message tag['commit_message'] - json.time_ago time_from_now(tag['commit_time'].to_time) + json.message tag['commit']['message'] + json.time_ago time_from_now(tag['commit']['commiter']['date'].to_time) 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 diff --git a/public/docs/api.html b/public/docs/api.html index 763134f4e..6bd5c592e 100644 --- a/public/docs/api.html +++ b/public/docs/api.html @@ -6222,6 +6222,20 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat string 项目标识identifier + +page +否 +1 +integer +页码 + + +limit +否 +20 +integer +每页个数 +

返回字段说明:

@@ -6252,6 +6266,16 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat + + + + + + + + + + @@ -6276,6 +6300,11 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat + + + + +
标签tar包下载地址
taggerobject打标签的人
messagestring标签信息
commit object 标签最后一个commitobject commit的提交者
commit.authorobjectcommit的作者
@@ -6287,15 +6316,28 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat "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", + "tagger": { + "id": 4, + "login": "testforge1", + "name": "testforge1", + "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png" + }, + "message": "jdfkls", "commit": { "sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7", "message": "add\n", - "time_ago": "4小时前", + "time_ago": "1天前", "committer": { "id": 4, "login": "testforge1", "name": "testforge1", "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" } } }, @@ -6304,15 +6346,28 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat "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", + "tagger": { + "id": null, + "login": "viletyy", + "name": "viletyy", + "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png" + }, + "message": "dfks", "commit": { "sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf", "message": "ADD file via upload\n", - "time_ago": "9天前", + "time_ago": "21天前", "committer": { - "id": 2, + "id": null, "login": "yystopf", - "name": "heh", - "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png" + "name": "yystopf", + "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" } } }