Merge branch 'dev_trustie' into dev_chain
This commit is contained in:
commit
21417ad300
|
@ -9,6 +9,7 @@ class RepositoriesController < ApplicationController
|
||||||
before_action :authorizate_user_can_edit_repo!, only: %i[sync_mirror]
|
before_action :authorizate_user_can_edit_repo!, only: %i[sync_mirror]
|
||||||
before_action :get_ref, only: %i[entries sub_entries top_counts]
|
before_action :get_ref, only: %i[entries sub_entries top_counts]
|
||||||
before_action :get_statistics, only: %i[top_counts]
|
before_action :get_statistics, only: %i[top_counts]
|
||||||
|
before_action :get_latest_commit, %i[entries sub_entries top_counts]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@user = current_user
|
@user = current_user
|
||||||
|
@ -126,7 +127,7 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO 获取最新commit信息
|
# TODO 获取最新commit信息
|
||||||
def get_latest_commit
|
def project_commits
|
||||||
Gitea::Repository::Commits::ListService.new(@project.owner.login, @project.identifier,
|
Gitea::Repository::Commits::ListService.new(@project.owner.login, @project.identifier,
|
||||||
sha: get_ref, page: 1, limit: 1, token: current_user&.gitea_token).call
|
sha: get_ref, page: 1, limit: 1, token: current_user&.gitea_token).call
|
||||||
end
|
end
|
||||||
|
@ -134,16 +135,18 @@ class RepositoriesController < ApplicationController
|
||||||
def get_statistics
|
def get_statistics
|
||||||
@branches_count = Gitea::Repository::Branches::ListService.new(@project.owner, @project.identifier).call&.size
|
@branches_count = Gitea::Repository::Branches::ListService.new(@project.owner, @project.identifier).call&.size
|
||||||
@tags_count = Gitea::Repository::Tags::ListService.new(current_user&.gitea_token, @project.owner.login, @project.identifier).call&.size
|
@tags_count = Gitea::Repository::Tags::ListService.new(current_user&.gitea_token, @project.owner.login, @project.identifier).call&.size
|
||||||
|
|
||||||
latest_commit = get_latest_commit
|
|
||||||
@latest_commit = latest_commit[:body][0] if latest_commit.present?
|
|
||||||
@commits_count = latest_commit[:total_count] if latest_commit.present?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_ref
|
def get_ref
|
||||||
@ref = params[:ref] || "master"
|
@ref = params[:ref] || "master"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_latest_commit
|
||||||
|
latest_commit = project_commits
|
||||||
|
@latest_commit = latest_commit[:body][0] if latest_commit.present?
|
||||||
|
@commits_count = latest_commit[:total_count] if latest_commit.present?
|
||||||
|
end
|
||||||
|
|
||||||
def content_params
|
def content_params
|
||||||
{
|
{
|
||||||
filepath: params[:filepath],
|
filepath: params[:filepath],
|
||||||
|
|
Loading…
Reference in New Issue