Browse Source

Merge branch 'develop' into standalone_develop

pull/313/head
yystopf 3 years ago
parent
commit
4683b20b3d
3 changed files with 9 additions and 9 deletions
  1. +7
    -7
      app/controllers/statistic_controller.rb
  2. +1
    -1
      app/interactors/gitea/create_file_interactor.rb
  3. +1
    -1
      app/services/gitea/repository/entries/create_service.rb

+ 7
- 7
app/controllers/statistic_controller.rb View File

@@ -2,24 +2,24 @@ class StatisticController < ApplicationController

# 平台概况
def platform_profile
@platform_user_query = Statistic::PlatformUserQuery.new(params).call
@platform_project_query = Statistic::PlatformProjectQuery.new(params).call
@platform_course_query = Statistic::PlatformCourseQuery.new(params).call
@platform_user_query = Statistic::PlatformUserQuery.new(params).call rescue [0, 0, 0]
@platform_project_query = Statistic::PlatformProjectQuery.new(params).call rescue [0, 0, 0]
@platform_course_query = Statistic::PlatformCourseQuery.new(params).call rescue [0, 0, 0]
end

# 平台代码提交数据
def platform_code
@platform_pull_request_query = Statistic::PlatformPullRequestQuery.new(params).call
@platform_commit_query = Statistic::PlatformCommitQuery.new(params,current_user).call
@platform_pull_request_query = Statistic::PlatformPullRequestQuery.new(params).call rescue [0, 0]
@platform_commit_query = Statistic::PlatformCommitQuery.new(params,current_user).call rescue [0, 0]
end

# 项目案例活跃度排行榜
def active_project_rank
@active_project_rank_query = Statistic::ActiveProjectRankQuery.new(params, current_user).call
@active_project_rank_query = Statistic::ActiveProjectRankQuery.new(params, current_user).call rescue []
end

# 开发者活跃度排行榜
def active_developer_rank
@active_developer_rank_query = Statistic::ActiveDeveloperRankQuery.new(params, current_user).call
@active_developer_rank_query = Statistic::ActiveDeveloperRankQuery.new(params, current_user).call rescue []
end
end

+ 1
- 1
app/interactors/gitea/create_file_interactor.rb View File

@@ -62,7 +62,7 @@ module Gitea
file_params = {}
file_params = file_params.merge(branch: @params[:branch]) unless @params[:branch].blank?
file_params = file_params.merge(new_branch: @params[:new_branch]) unless @params[:new_branch].blank?
file_params = file_params.merge(content: Base64.encode64(@params[:content] || ""))
file_params = file_params.merge(content: @params[:content] || "")
file_params = file_params.merge(message: @params[:message]) unless @params[:message].blank?
file_params = file_params.merge(committer: @params[:committer])
file_params


+ 1
- 1
app/services/gitea/repository/entries/create_service.rb View File

@@ -56,7 +56,7 @@ class Gitea::Repository::Entries::CreateService < Gitea::ClientService
when 403 then error("你没有权限操作!")
when 404 then error("你操作的链接不存在!")
when 422
if @body[:new_branch].include?('/') || @body[:new_branch].include?('\'') || @body[:new_branch].include?('^') || @body[:new_branch].include?('*')
if @body[:new_branch].present? && (@body[:new_branch].include?('/') || @body[:new_branch].include?('\'') || @body[:new_branch].include?('^') || @body[:new_branch].include?('*'))
error("不合法的分支名称!")
else
error("#{filepath}文件已存在,不能重复创建!")


Loading…
Cancel
Save