add: repo contributors
This commit is contained in:
parent
25186b4e81
commit
6a7ef2a1a7
|
@ -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]})
|
@tags = Gitea::Repository::Tags::ListService.call(current_user&.gitea_token, @owner.login, @project.identifier, {page: params[:page], limit: params[:limit]})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def contributors
|
||||||
|
@contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
|
||||||
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
return render_forbidden if !@project.manager?(current_user) && !current_user.admin?
|
return render_forbidden if !@project.manager?(current_user) && !current_user.admin?
|
||||||
end
|
end
|
||||||
|
|
|
@ -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]
|
match :sub_entries, :via => [:get, :put]
|
||||||
get :commits
|
get :commits
|
||||||
get :tags
|
get :tags
|
||||||
|
get :contributors
|
||||||
post :create_file
|
post :create_file
|
||||||
put :update_file
|
put :update_file
|
||||||
delete :delete_file
|
delete :delete_file
|
||||||
|
|
Loading…
Reference in New Issue