mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
add: repo contributors
This commit is contained in:
@@ -106,6 +106,10 @@ class RepositoriesController < ApplicationController
|
||||
@tags = Gitea::Repository::Tags::ListService.call(current_user&.gitea_token, @owner.login, @project.identifier, {page: params[:page], limit: params[:limit]})
|
||||
end
|
||||
|
||||
def contributors
|
||||
@contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
|
||||
end
|
||||
|
||||
def edit
|
||||
return render_forbidden if !@project.manager?(current_user) && !current_user.admin?
|
||||
end
|
||||
|
||||
17
app/views/repositories/contributors.json.jbuilder
Normal file
17
app/views/repositories/contributors.json.jbuilder
Normal file
@@ -0,0 +1,17 @@
|
||||
total_count = @contributors.size
|
||||
json.contributors @contributors.each do |contributor|
|
||||
user = User.find_by(gitea_uid: contributor["id"])
|
||||
if contributor["login"] == "root"
|
||||
total_count -= 1
|
||||
next
|
||||
end
|
||||
json.contributions contributor["contributions"]
|
||||
json.gid contributor["id"]
|
||||
json.login user.login
|
||||
json.type user&.type
|
||||
json.name user.real_name
|
||||
json.image_url url_to_avatar(user)
|
||||
end
|
||||
json.total_count total_count
|
||||
|
||||
|
||||
@@ -389,6 +389,7 @@ Rails.application.routes.draw do
|
||||
match :sub_entries, :via => [:get, :put]
|
||||
get :commits
|
||||
get :tags
|
||||
get :contributors
|
||||
post :create_file
|
||||
put :update_file
|
||||
delete :delete_file
|
||||
|
||||
Reference in New Issue
Block a user