Browse Source

Delete create labels for gitea platform

tags/v1.0.0
Jasder 5 years ago
parent
commit
8d46eecc2c
1 changed files with 18 additions and 18 deletions
  1. +18
    -18
      app/controllers/issue_tags_controller.rb

+ 18
- 18
app/controllers/issue_tags_controller.rb View File

@@ -38,12 +38,12 @@ class IssueTagsController < ApplicationController
begin begin
issue_tag = IssueTag.new(tag_params.merge(project_id: @project.id, user_id: current_user.id)) issue_tag = IssueTag.new(tag_params.merge(project_id: @project.id, user_id: current_user.id))
if issue_tag.save 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, "标签创建成功")
else
normal_status(-1, "标签创建失败")
end
# 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, "标签创建成功")
# else
# normal_status(-1, "标签创建失败")
# end
else else
normal_status(-1, "标签创建失败") normal_status(-1, "标签创建失败")
end end
@@ -79,12 +79,12 @@ class IssueTagsController < ApplicationController
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
if gitea_tag
normal_status(0, "标签更新成功")
else
normal_status(-1, "标签更新失败")
end
# gitea_tag = Gitea::Labels::UpdateService.new(current_user, @repository.try(:identifier),@issue_tag.try(:gid), tag_params).call
# if gitea_tag
# normal_status(0, "标签更新成功")
# else
# normal_status(-1, "标签更新失败")
# end
else else
normal_status(-1, "标签更新失败") normal_status(-1, "标签更新失败")
end end
@@ -103,12 +103,12 @@ class IssueTagsController < ApplicationController
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
if @issue_tag.destroy 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, "标签删除成功")
else
normal_status(-1, "标签删除失败")
end
# issue_tag = Gitea::Labels::DeleteService.new(@user, @repository.try(:identifier), @issue_tag.try(:gid)).call
# if issue_tag
# normal_status(0, "标签删除成功")
# else
# normal_status(-1, "标签删除失败")
# end
else else
normal_status(-1, "标签删除失败") normal_status(-1, "标签删除失败")
end end


Loading…
Cancel
Save