forked from Gitlink/forgeplus
Merge branch 'standalone_develop' into pre_trustie_server
This commit is contained in:
commit
58a684e3db
|
|
@ -2,7 +2,7 @@ class Api::V1::ProjectTopicsController < Api::V1::BaseController
|
|||
|
||||
def index
|
||||
@project_topics = ProjectTopic
|
||||
@project_topics = @project_topics.ransack(name_cont: params[:keyword]) if params[:keyword].present?
|
||||
@project_topics = @project_topics.ransack(name_cont: params[:keyword]).result if params[:keyword].present?
|
||||
# @project_topics = @project_topics.includes(:projects)
|
||||
@project_topics = kaminary_select_paginate(@project_topics)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class CommitLogsController < ApplicationController
|
|||
project = Project.where(identifier: repository_name).where(user_id: owner&.id)&.first
|
||||
project = Project.where(identifier: repository_name).where(gpid: repository_id)&.first if project.blank?
|
||||
project.update_column(:updated_on, Time.now) if project.present?
|
||||
render_ok if project.project_type == 'mirror'
|
||||
params[:commits].each do |commit|
|
||||
commit_id = commit[:id]
|
||||
message = commit[:message]
|
||||
|
|
@ -36,6 +37,7 @@ class CommitLogsController < ApplicationController
|
|||
solve_issue_content = message.to_s.scan(/\b(Fix|Fixes|Fixed|Fixing|fix|fixes|fixed|fixing|Resolve|Resolves|Resolved|Resolving|resolve|resolves|resolved|resolving|Implement|Implements|Implemented|Implementing|implement|implements|implemented|implementing)\s*(#\d+(,\s*#\d+)*)?\b/)
|
||||
ChangeIssueStatusByMessageJob.perform_later(commit_id, project, commit_user, solve_issue_content[0][1], 3) if solve_issue_content[0].present? && solve_issue_content[0][1].present?
|
||||
end
|
||||
render_ok
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def content_params
|
||||
{
|
||||
base64_filepath: params[:base64_filepath],
|
||||
filepath: params[:filepath],
|
||||
branch: params[:branch],
|
||||
new_branch: params[:new_branch],
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ module Gitea
|
|||
else
|
||||
@params[:filepath]
|
||||
end
|
||||
rescue
|
||||
@params[:filepath]
|
||||
end
|
||||
|
||||
def valid_params
|
||||
|
|
|
|||
|
|
@ -51,10 +51,12 @@ module Gitea
|
|||
|
||||
def file_path
|
||||
if @params[:base64_filepath].present?
|
||||
Base64.decode64(params[:base64_filepath])
|
||||
Base64.strict_decode64(params[:base64_filepath])
|
||||
else
|
||||
@params[:filepath]
|
||||
end
|
||||
rescue
|
||||
@params[:filepath]
|
||||
end
|
||||
|
||||
def valid_params
|
||||
|
|
|
|||
|
|
@ -50,18 +50,22 @@ module Gitea
|
|||
|
||||
def file_path
|
||||
if @params[:base64_filepath].present?
|
||||
Base64.decode64(params[:base64_filepath])
|
||||
Base64.strict_decode64(params[:base64_filepath])
|
||||
else
|
||||
@params[:filepath]
|
||||
end
|
||||
rescue
|
||||
@params[:filepath]
|
||||
end
|
||||
|
||||
def from_file_path
|
||||
if @params[:base64_from_path].present?
|
||||
Base64.decode64(params[:base64_from_path])
|
||||
Base64.strict_decode64(params[:base64_from_path])
|
||||
else
|
||||
@params[:from_path]
|
||||
end
|
||||
rescue
|
||||
@params[:from_path]
|
||||
end
|
||||
|
||||
def valid_params
|
||||
|
|
|
|||
|
|
@ -61,7 +61,9 @@ class Gitea::Repository::Entries::CreateService < Gitea::ClientService
|
|||
else
|
||||
if json_parse!(body)["message"].present? && json_parse!(body)["message"].starts_with?("branch already exists")
|
||||
error("#{@body[:new_branch]}分支已存在!")
|
||||
else
|
||||
elsif json_parse!(body)["message"].present? && json_parse!(body)["message"].starts_with?("illegal base64 data at input byte 4")
|
||||
error("文件内容必须是base64编码的!")
|
||||
else
|
||||
error("#{filepath}文件已存在,不能重复创建!")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class PullRequests::CreateService < ApplicationService
|
|||
def compare_head_base!
|
||||
head = pull_request.is_original && @params[:merge_user_login] ? "#{@params[:merge_user_login]}/#{@params[:merge_project_identifier]}:#{@params[:head]}" : @params[:head]
|
||||
compare_result = Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, Addressable::URI.escape(@params[:base]), Addressable::URI.escape(head), @current_user.gitea_token)
|
||||
raise '分支内容相同,无需创建合并请求' if compare_result["Commits"].blank? && compare_result["Diff"].blank?
|
||||
raise '分支内容相同,无需创建合并请求' if compare_result["Commits"].blank? && compare_result["Diff"].blank? && compare_result["FilesCount"].zero?
|
||||
end
|
||||
|
||||
def is_original
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Repositories::MigrateService < ApplicationService
|
|||
private: params[:hidden],
|
||||
mirror: wrapper_mirror || false,
|
||||
auth_username: params[:login],
|
||||
auth_password: Base64.decode64(params[:password] || ""),
|
||||
auth_password: base64_decode_password,
|
||||
auth_token: params[:auth_token],
|
||||
service: params[:service] || 'git',
|
||||
}
|
||||
|
|
@ -41,4 +41,10 @@ class Repositories::MigrateService < ApplicationService
|
|||
def wrapper_mirror
|
||||
ActiveModel::Type::Boolean.new.cast(params[:is_mirror])
|
||||
end
|
||||
|
||||
def base64_decode_password
|
||||
Base64.strict_decode64(params[:password] || "")
|
||||
rescue
|
||||
params[:password]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue