Merge branch 'develop' of http://git.trustie.net/jasder/forgeplus into develop

This commit is contained in:
Jasder
2020-03-25 12:05:39 +08:00
156 changed files with 4051714 additions and 115 deletions

View File

@@ -233,8 +233,6 @@ class ApplicationController < ActionController::Base
# 未授权的捕捉407弹试用申请弹框
def require_login
#6.13 -hs
Rails.logger.info("########____________________########{User.current.login}")
Rails.logger.info("########____________________########{User.current.logged?}")
tip_exception(401, "请登录后再操作") unless User.current.logged?
end

View File

@@ -16,6 +16,8 @@ class PullRequestsController < ApplicationController
@close_issues_size = issues.where(status_id: 5).size
@assign_to_me_size = issues.where(assigned_to_id: current_user&.id).size
@my_published_size = issues.where(author_id: current_user&.id).size
@user_admin_or_member = current_user.present? && (current_user.admin || @project.member?(current_user))
status_type = params[:status_type] || "1" #issue状态的选择
search_name = params[:search].to_s

View File

@@ -57,18 +57,20 @@ class RepositoriesController < ApplicationController
end
def update_file
interactor = Gitea::UpdateFileInteractor.call(current_user, params.merge(identifier: @project.identifier).compact)
interactor = Gitea::UpdateFileInteractor.call(current_user, params.merge(identifier: @project.identifier))
if interactor.success?
@file = interactor.result
render_result(1, "更新成功")
else
render_error(interactor.error)
end
end
def delete_file
interactor = Gitea::DeleteFileInteractor.call(current_user, params.merge(identifier: @project.identifier).compact)
interactor = Gitea::DeleteFileInteractor.call(current_user, params.merge(identifier: @project.identifier))
if interactor.success?
@file = interactor.result
render_result(1, "文件删除成功")
else
render_error(interactor.error)
end

View File

@@ -25,7 +25,7 @@ class Projects::ForkService < ApplicationService
result = Gitea::Repository::ForkService.new(@project.owner, @target_owner, @project.identifier, @organization).call
@project.update_column('forked_count', @project.forked_count + 1)
@project.update_column('forked_count', @project&.forked_count.to_i + 1)
new_repository.update_column('url', result['clone_url']) if result
clone_project

View File

@@ -1,6 +1,10 @@
if @new_project
json.status 0
json.message "fork项目成功"
json.id @new_project.id
json.identifier @new_project.identifier
else
json.status -1
json.message "fork项目失败"
json.nil!
end

View File

@@ -6,6 +6,7 @@ json.assign_me_count @assign_to_me_size
json.my_published_count @my_published_size
json.search_count @issues_size
json.limit @limit
json.user_admin_or_member @user_admin_or_member
json.issues do
json.array! @issues.to_a do |issue|