fix: project labels return success info
This commit is contained in:
parent
d16f290aa6
commit
f8654edc3b
|
@ -29,7 +29,7 @@ class IssueTagsController < ApplicationController
|
||||||
|
|
||||||
if title.present?
|
if title.present?
|
||||||
if IssueTag.exists?(name: title, project_id: @project.id)
|
if IssueTag.exists?(name: title, project_id: @project.id)
|
||||||
normal_status(-1, "标签已存在")
|
normal_status(-1, "项目标记已存在")
|
||||||
else
|
else
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
begin
|
begin
|
||||||
|
@ -37,12 +37,12 @@ class IssueTagsController < ApplicationController
|
||||||
if issue_tag.save
|
if issue_tag.save
|
||||||
# gitea_tag = Gitea::Labels::CreateService.new(current_user, @repository.try(:identifier), tag_params).call
|
# 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"])
|
# if gitea_tag && issue_tag.update_attributes(gid: gitea_tag["id"], gitea_url: gitea_tag["url"])
|
||||||
# normal_status(0, "标签创建成功")
|
normal_status(0, "项目标记创建成功!")
|
||||||
# else
|
# else
|
||||||
# normal_status(-1, "标签创建失败")
|
# normal_status(-1, "项目标记创建失败")
|
||||||
# end
|
# end
|
||||||
else
|
else
|
||||||
normal_status(-1, "标签创建失败")
|
normal_status(-1, "项目标记创建失败")
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "create version release error: #{e.message}"
|
puts "create version release error: #{e.message}"
|
||||||
|
@ -51,7 +51,7 @@ class IssueTagsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
normal_status(-1, "标签名称不能为空")
|
normal_status(-1, "项目标记名称不能为空")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,19 +71,19 @@ class IssueTagsController < ApplicationController
|
||||||
}
|
}
|
||||||
if title.present?
|
if title.present?
|
||||||
if IssueTag.exists?(name: title, project_id: @project.id) && (@issue_tag.name != title)
|
if IssueTag.exists?(name: title, project_id: @project.id) && (@issue_tag.name != title)
|
||||||
normal_status(-1, "标签已存在")
|
normal_status(-1, "项目标记已存在")
|
||||||
else
|
else
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
begin
|
begin
|
||||||
if @issue_tag.update_attributes(tag_params)
|
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
|
# gitea_tag = Gitea::Labels::UpdateService.new(current_user, @repository.try(:identifier),@issue_tag.try(:gid), tag_params).call
|
||||||
# if gitea_tag
|
# if gitea_tag
|
||||||
# normal_status(0, "标签更新成功")
|
# normal_status(0, "项目标记更新成功")
|
||||||
# else
|
# else
|
||||||
# normal_status(-1, "标签更新失败")
|
# normal_status(-1, "项目标记更新失败")
|
||||||
# end
|
# end
|
||||||
else
|
else
|
||||||
normal_status(-1, "标签更新失败")
|
normal_status(-1, "项目标记更新失败")
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "create version release error: #{e.message}"
|
puts "create version release error: #{e.message}"
|
||||||
|
@ -92,7 +92,7 @@ class IssueTagsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
normal_status(-1, "标签名称不能为空")
|
normal_status(-1, "项目标记名称不能为空")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,12 +102,12 @@ class IssueTagsController < ApplicationController
|
||||||
if @issue_tag.destroy
|
if @issue_tag.destroy
|
||||||
# issue_tag = Gitea::Labels::DeleteService.new(@user, @repository.try(:identifier), @issue_tag.try(:gid)).call
|
# issue_tag = Gitea::Labels::DeleteService.new(@user, @repository.try(:identifier), @issue_tag.try(:gid)).call
|
||||||
# if issue_tag
|
# if issue_tag
|
||||||
# normal_status(0, "标签删除成功")
|
# normal_status(0, "项目标记删除成功")
|
||||||
# else
|
# else
|
||||||
# normal_status(-1, "标签删除失败")
|
# normal_status(-1, "项目标记删除失败")
|
||||||
# end
|
# end
|
||||||
else
|
else
|
||||||
normal_status(-1, "标签删除失败")
|
normal_status(-1, "项目标记删除失败")
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "create version release error: #{e.message}"
|
puts "create version release error: #{e.message}"
|
||||||
|
@ -131,7 +131,7 @@ class IssueTagsController < ApplicationController
|
||||||
def set_issue_tag
|
def set_issue_tag
|
||||||
@issue_tag = IssueTag.find_by_id(params[:id])
|
@issue_tag = IssueTag.find_by_id(params[:id])
|
||||||
unless @issue_tag.present?
|
unless @issue_tag.present?
|
||||||
normal_status(-1, "标签不存在")
|
normal_status(-1, "项目标记不存在")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue