Merge pull request '提交最新代码到预上线环境' (#272) from develop into standalone_develop
This commit is contained in:
commit
6ffc702209
|
@ -29,7 +29,7 @@ class IssueTagsController < ApplicationController
|
|||
|
||||
if title.present?
|
||||
if IssueTag.exists?(name: title, project_id: @project.id)
|
||||
normal_status(-1, "标签已存在")
|
||||
normal_status(-1, "项目标记已存在")
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
|
@ -37,12 +37,12 @@ class IssueTagsController < ApplicationController
|
|||
if issue_tag.save
|
||||
# gitea_tag = Gitea::Labels::CreateService.new(current_user, @repository.try(:identifier), tag_params).call
|
||||
# if gitea_tag && issue_tag.update_attributes(gid: gitea_tag["id"], gitea_url: gitea_tag["url"])
|
||||
# normal_status(0, "标签创建成功")
|
||||
normal_status(0, "项目标记创建成功!")
|
||||
# else
|
||||
# normal_status(-1, "标签创建失败")
|
||||
# normal_status(-1, "项目标记创建失败")
|
||||
# end
|
||||
else
|
||||
normal_status(-1, "标签创建失败")
|
||||
normal_status(-1, "项目标记创建失败")
|
||||
end
|
||||
rescue => e
|
||||
puts "create version release error: #{e.message}"
|
||||
|
@ -51,7 +51,7 @@ class IssueTagsController < ApplicationController
|
|||
end
|
||||
end
|
||||
else
|
||||
normal_status(-1, "标签名称不能为空")
|
||||
normal_status(-1, "项目标记名称不能为空")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -71,19 +71,19 @@ class IssueTagsController < ApplicationController
|
|||
}
|
||||
if title.present?
|
||||
if IssueTag.exists?(name: title, project_id: @project.id) && (@issue_tag.name != title)
|
||||
normal_status(-1, "标签已存在")
|
||||
normal_status(-1, "项目标记已存在")
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
if @issue_tag.update_attributes(tag_params)
|
||||
# gitea_tag = Gitea::Labels::UpdateService.new(current_user, @repository.try(:identifier),@issue_tag.try(:gid), tag_params).call
|
||||
# if gitea_tag
|
||||
# normal_status(0, "标签更新成功")
|
||||
# normal_status(0, "项目标记更新成功")
|
||||
# else
|
||||
# normal_status(-1, "标签更新失败")
|
||||
# normal_status(-1, "项目标记更新失败")
|
||||
# end
|
||||
else
|
||||
normal_status(-1, "标签更新失败")
|
||||
normal_status(-1, "项目标记更新失败")
|
||||
end
|
||||
rescue => e
|
||||
puts "create version release error: #{e.message}"
|
||||
|
@ -92,7 +92,7 @@ class IssueTagsController < ApplicationController
|
|||
end
|
||||
end
|
||||
else
|
||||
normal_status(-1, "标签名称不能为空")
|
||||
normal_status(-1, "项目标记名称不能为空")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -102,12 +102,12 @@ class IssueTagsController < ApplicationController
|
|||
if @issue_tag.destroy
|
||||
# issue_tag = Gitea::Labels::DeleteService.new(@user, @repository.try(:identifier), @issue_tag.try(:gid)).call
|
||||
# if issue_tag
|
||||
# normal_status(0, "标签删除成功")
|
||||
# normal_status(0, "项目标记删除成功")
|
||||
# else
|
||||
# normal_status(-1, "标签删除失败")
|
||||
# normal_status(-1, "项目标记删除失败")
|
||||
# end
|
||||
else
|
||||
normal_status(-1, "标签删除失败")
|
||||
normal_status(-1, "项目标记删除失败")
|
||||
end
|
||||
rescue => e
|
||||
puts "create version release error: #{e.message}"
|
||||
|
@ -131,7 +131,7 @@ class IssueTagsController < ApplicationController
|
|||
def set_issue_tag
|
||||
@issue_tag = IssueTag.find_by_id(params[:id])
|
||||
unless @issue_tag.present?
|
||||
normal_status(-1, "标签不存在")
|
||||
normal_status(-1, "项目标记不存在")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -125,9 +125,15 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
if params[:issue_tag_ids].present?
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
IssueTagsRelate.create!(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
if params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size > 1
|
||||
return normal_status(-1, "最多只能创建一个标记。")
|
||||
elsif params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size == 1
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
IssueTagsRelate.create!(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
else
|
||||
return normal_status(-1, "请输入正确的标记。")
|
||||
end
|
||||
end
|
||||
if params[:assigned_to_id].present?
|
||||
Tiding.create!(user_id: params[:assigned_to_id], trigger_user_id: current_user.id,
|
||||
|
@ -146,7 +152,7 @@ class IssuesController < ApplicationController
|
|||
Rails.logger.info "[ATME] maybe to at such users: #{@atme_receivers.pluck(:login)}"
|
||||
AtmeService.call(current_user, @atme_receivers, @issue) if @atme_receivers.size > 0
|
||||
|
||||
render json: {status: 0, message: "创建成", id: @issue.id}
|
||||
render json: {status: 0, message: "创建成功", id: @issue.id}
|
||||
else
|
||||
normal_status(-1, "创建失败")
|
||||
end
|
||||
|
@ -165,11 +171,17 @@ class IssuesController < ApplicationController
|
|||
last_token = @issue.token
|
||||
last_status_id = @issue.status_id
|
||||
@issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank?
|
||||
if params[:issue_tag_ids].present? && !@issue&.issue_tags_relates.where(issue_tag_id: params[:issue_tag_ids]).exists?
|
||||
@issue&.issue_tags_relates&.destroy_all
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
IssueTagsRelate.create(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
if params[:issue_tag_ids].present?
|
||||
if params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size > 1
|
||||
return normal_status(-1, "最多只能创建一个标记。")
|
||||
elsif params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size == 1
|
||||
@issue&.issue_tags_relates&.destroy_all
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
IssueTagsRelate.create!(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
else
|
||||
return normal_status(-1, "请输入正确的标记。")
|
||||
end
|
||||
end
|
||||
|
||||
issue_files = params[:attachment_ids]
|
||||
|
|
|
@ -70,6 +70,8 @@ class PullRequestsController < ApplicationController
|
|||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
rescue => e
|
||||
normal_status(-1, e.message)
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -91,10 +93,16 @@ class PullRequestsController < ApplicationController
|
|||
|
||||
@issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank?
|
||||
if params[:issue_tag_ids].present? && !@issue&.issue_tags_relates.where(issue_tag_id: params[:issue_tag_ids]).exists?
|
||||
@issue&.issue_tags_relates&.destroy_all
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
IssueTagsRelate.create(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
if params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size > 1
|
||||
return normal_status(-1, "最多只能创建一个标记。")
|
||||
elsif params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size == 1
|
||||
@issue&.issue_tags_relates&.destroy_all
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
IssueTagsRelate.create!(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
else
|
||||
return normal_status(-1, "请输入正确的标记。")
|
||||
end
|
||||
end
|
||||
|
||||
if @issue.update_attributes(@issue_params)
|
||||
|
@ -104,9 +112,16 @@ class PullRequestsController < ApplicationController
|
|||
|
||||
if gitea_pull[:status] === :success
|
||||
if params[:issue_tag_ids].present?
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
IssueTagsRelate.create(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
if params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size > 1
|
||||
return normal_status(-1, "最多只能创建一个标记。")
|
||||
elsif params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size == 1
|
||||
@issue&.issue_tags_relates&.destroy_all
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
IssueTagsRelate.create!(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
else
|
||||
return normal_status(-1, "请输入正确的标记。")
|
||||
end
|
||||
end
|
||||
if params[:status_id].to_i == 5
|
||||
@issue.issue_times.update_all(end_time: Time.now)
|
||||
|
@ -273,7 +288,7 @@ class PullRequestsController < ApplicationController
|
|||
assigned_to_id: params[:assigned_to_id],
|
||||
fixed_version_id: params[:fixed_version_id],
|
||||
issue_tags_value: params[:issue_tag_ids].present? ? params[:issue_tag_ids].join(",") : "",
|
||||
priority_id: params[:priority_id] || "2",
|
||||
priority_id: params[:priority_id],
|
||||
issue_classify: "pull_request",
|
||||
issue_type: params[:issue_type] || "1",
|
||||
tracker_id: 2,
|
||||
|
|
|
@ -10,7 +10,7 @@ module RepositoriesHelper
|
|||
end
|
||||
|
||||
def download_type(str)
|
||||
default_type = %w(xlsx xls ppt pptx pdf zip 7z rar exe pdb obj idb RData rdata doc docx mpp vsdx dot otf eot ttf woff woff2)
|
||||
default_type = %w(xlsx xls ppt pptx pdf zip 7z rar exe pdb obj idb RData rdata doc docx mpp vsdx dot otf eot ttf woff woff2 mp4 mov wmv flv mpeg avi avchd webm mkv)
|
||||
default_type.include?(str&.downcase)
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# category_id :integer
|
||||
# status_id :integer not null
|
||||
# assigned_to_id :integer
|
||||
# priority_id :integer not null
|
||||
# priority_id :integer
|
||||
# fixed_version_id :integer
|
||||
# author_id :integer not null
|
||||
# created_on :datetime
|
||||
|
|
|
@ -60,6 +60,6 @@ class Projects::CreateService < ApplicationService
|
|||
# end
|
||||
|
||||
def repo_is_public
|
||||
params[:private].blank? ? true : !params[:private]
|
||||
params[:private].blank? ? true : !(ActiveModel::Type::Boolean.new.cast(params[:private]).nil? ? false : ActiveModel::Type::Boolean.new.cast(params[:private]))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,6 +13,7 @@ class PullRequests::CreateService < ApplicationService
|
|||
def call
|
||||
ActiveRecord::Base.transaction do
|
||||
validate!
|
||||
compare_head_base!
|
||||
save_pull_issue!
|
||||
save_pull_request!
|
||||
save_issue_tags_relates!
|
||||
|
@ -33,7 +34,7 @@ class PullRequests::CreateService < ApplicationService
|
|||
assigned_to_id: @params[:assigned_to_id],
|
||||
fixed_version_id: @params[:fixed_version_id],
|
||||
issue_tags_value: @params[:issue_tag_ids].present? ? @params[:issue_tag_ids].join(",") : "",
|
||||
priority_id: @params[:priority_id] || "2",
|
||||
priority_id: @params[:priority_id],
|
||||
issue_classify: "pull_request",
|
||||
issue_type: @params[:issue_type] || "1",
|
||||
tracker_id: 2,
|
||||
|
@ -58,8 +59,12 @@ class PullRequests::CreateService < ApplicationService
|
|||
end
|
||||
|
||||
def save_issue_tags_relates!
|
||||
issue_tag_ids.each do |tag|
|
||||
IssueTagsRelate.create!(issue_id: pull_issue.id, issue_tag_id: tag)
|
||||
if issue_tag_ids.size > 1
|
||||
raise "最多只能创建一个标记。"
|
||||
else
|
||||
issue_tag_ids.each do |tag|
|
||||
IssueTagsRelate.create!(issue_id: pull_issue.id, issue_tag_id: tag)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -145,12 +150,19 @@ class PullRequests::CreateService < ApplicationService
|
|||
raise "title参数不能为空" if @params[:title].blank?
|
||||
raise "head参数不能为空" if @params[:head].blank?
|
||||
raise "base参数不能为空" if @params[:base].blank?
|
||||
raise "fork_project_id参数错误" unless @project.forked_projects.pluck(:id).include?(@params[:fork_project_id])
|
||||
raise "分支内容相同,无需创建合并请求" if @params[:head] === @params[:base] && !is_original
|
||||
raise "合并请求已存在" if @project&.pull_requests.where(head: @params[:head], base: @params[:base], status: 0, is_original: is_original, fork_project_id: @params[:fork_project_id]).present?
|
||||
raise @pull_issue.errors.full_messages.join(", ") unless pull_issue.valid?
|
||||
raise @pull_request.errors.full_messages.join(", ") unless pull_request.valid?
|
||||
end
|
||||
|
||||
def compare_head_base!
|
||||
head = pull_request.is_original && @params[:merge_user_login] ? "#{@params[:merge_user_login]}/#{@project.identifier}:#{@params[:head]}" : @params[:head]
|
||||
compare_result = Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, @params[:base], head, @current_user.gitea_token)
|
||||
raise '分支内容相同,无需创建合并请求' if compare_result["Commits"].blank? && compare_result["Diff"].blank?
|
||||
end
|
||||
|
||||
def is_original
|
||||
@params[:is_original] || false
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
pr = issue.pull_request
|
||||
json.pull_request_id pr.id
|
||||
json.pull_request_number pr.gitea_number
|
||||
json.pull_request_status pr.status
|
||||
json.pull_request_head pr.head
|
||||
json.pull_request_base pr.base
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeIssuesPriorityIdDefault < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
change_column_null :issues, :priority_id, true
|
||||
end
|
||||
end
|
|
@ -95,9 +95,8 @@ If you continue to experience problems please contact your Trustie administrator
|
|||
<img src="images/warn/pic_500.jpg" width="639px"/>
|
||||
<div class="font-16 mt56" style="text-align: center;">
|
||||
<p>服务器异常,请稍后重试</p>
|
||||
您可尝试<a href="javascript:location.reload();" class="color-blue">刷新页面</a>或<a href="/explore"
|
||||
class="color-blue">返回首页</a>,也可以通过
|
||||
<a target="_blank"
|
||||
您可尝试<a href="javascript:location.reload();" class="color-blue">刷新页面</a>或<a href="/"
|
||||
class="color-blue">返回首页</a>,也可以通过<a target="_blank"
|
||||
href="https://qm.qq.com/cgi-bin/qm/qr?k=YVGUhY7uK8ovpyd7tG_lHe2qGZ63LOij&jump_from=webapi"
|
||||
class="color-blue">QQ</a>向我们反馈
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue