mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-20 11:45:57 +08:00
新增: 创建分支接口
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
json.name branch
|
||||
json.http_url render_http_url(@project)
|
||||
json.zip_url render_zip_url(@owner, @project.repository, branch)
|
||||
json.tar_url render_tar_url(@owner, @project.repository, branch)
|
||||
@@ -0,0 +1,23 @@
|
||||
json.name branch['name']
|
||||
json.commit do
|
||||
json.id branch['commit']['id']
|
||||
json.message branch['commit']['message']
|
||||
json.author do
|
||||
|
||||
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(branch['commit']['author']), name: branch['commit']['author']['name'] }
|
||||
end
|
||||
|
||||
json.committer do
|
||||
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(branch['commit']['committer']), name: branch['commit']['committer']['name'] }
|
||||
end
|
||||
json.time_ago time_from_now(branch['commit']['timestamp'].to_time)
|
||||
json.timestamp branch['commit']['timestamp']
|
||||
end
|
||||
|
||||
json.protected branch['protected']
|
||||
json.user_can_push branch['user_can_push']
|
||||
json.user_can_merge branch['user_can_merge']
|
||||
json.commit_id branch['commit_id']
|
||||
json.commit_time_from_now branch['commit_time']
|
||||
json.commit_time branch['commit_time']
|
||||
json.default_branch branch['default_branch']
|
||||
3
app/views/api/v1/projects/branches/all.json.jbuilder
Normal file
3
app/views/api/v1/projects/branches/all.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
json.array! @result_object["branch_name"] do |branch|
|
||||
json.partial! "api/v1/projects/branches/simple_detail", branch: branch
|
||||
end
|
||||
1
app/views/api/v1/projects/branches/create.json.jbuilder
Normal file
1
app/views/api/v1/projects/branches/create.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "api/v1/projects/branches/simple_gitea_detail", branch: @result_object
|
||||
21
app/views/api/v1/users/_commit_user.json.jbuilder
Normal file
21
app/views/api/v1/users/_commit_user.json.jbuilder
Normal file
@@ -0,0 +1,21 @@
|
||||
if user.present?
|
||||
if user.is_a?(Hash)
|
||||
json.id user["id"]
|
||||
json.login user["login"]
|
||||
json.name user["name"]
|
||||
json.type user["type"]
|
||||
json.image_url user["avatar_url"]
|
||||
else
|
||||
json.id user.id
|
||||
json.login user.login
|
||||
json.name user.real_name
|
||||
json.type user&.type
|
||||
json.image_url url_to_avatar(user)
|
||||
end
|
||||
else
|
||||
json.id nil
|
||||
json.login name
|
||||
json.name name
|
||||
json.type nil
|
||||
json.image_url User::Avatar.get_letter_avatar_url(name)
|
||||
end
|
||||
Reference in New Issue
Block a user