mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 20:55:46 +08:00
issue links
This commit is contained in:
@@ -31,7 +31,7 @@ class Api::Pm::BaseController < ApplicationController
|
||||
|
||||
def load_issue
|
||||
return render_parameter_missing if params[:pm_project_id].blank?
|
||||
@issue = @project.issues.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:id])
|
||||
@issue = @project.issues.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:issue_id])
|
||||
render_not_found('疑修不存在!') if @issue.blank?
|
||||
end
|
||||
# 具有对仓库的管理权限
|
||||
|
||||
25
app/controllers/api/pm/issue_links_controller.rb
Normal file
25
app/controllers/api/pm/issue_links_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class Api::Pm::IssueLinksController < Api::Pm::BaseController
|
||||
before_action :load_project
|
||||
before_action :load_issue
|
||||
def index
|
||||
@links = @issue.pm_links.where(be_linkable_type: 'Issue')
|
||||
end
|
||||
|
||||
def create
|
||||
@link = @issue.pm_links.find_or_create_by(be_linkable_type: 'Issue', be_linkable_id: params[:link_id])
|
||||
data = {
|
||||
data: {
|
||||
id: @link.id,
|
||||
issue_id: @link.linkable_id,
|
||||
linked_issue_id: @link.be_linkable_id
|
||||
}
|
||||
}
|
||||
render_ok(data)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@link = @issue.pm_links.find params[:id]
|
||||
@link.destroy
|
||||
render_ok
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||
before_action :require_login, except: [:index]
|
||||
before_action :load_project
|
||||
before_action :load_issue, only: %i[show update destroy]
|
||||
before_action :load_issue, only: %i[show update destroy link_index]
|
||||
before_action :load_issues, only: %i[batch_update batch_destroy]
|
||||
before_action :check_issue_operate_permission, only: %i[update destroy]
|
||||
|
||||
@@ -19,6 +19,12 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||
render 'api/v1/issues/index'
|
||||
end
|
||||
|
||||
def link_index
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def show
|
||||
@issue.associate_attachment_container
|
||||
render 'api/v1/issues/show'
|
||||
@@ -91,6 +97,13 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||
return if params[:project_id].to_i.zero?
|
||||
render_forbidden('您没有操作权限!') unless @project.member?(current_user) || current_user.admin? || @issue.user == current_user
|
||||
end
|
||||
|
||||
def load_issue
|
||||
return render_parameter_missing if params[:pm_project_id].blank?
|
||||
@issue = @project.issues.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:id])
|
||||
render_not_found('疑修不存在!') if @issue.blank?
|
||||
end
|
||||
|
||||
def load_issues
|
||||
return render_error('请输入正确的ID数组!') unless params[:ids].is_a?(Array)
|
||||
params[:ids].each do |id|
|
||||
|
||||
Reference in New Issue
Block a user