|
|
|
@@ -1,6 +1,6 @@ |
|
|
|
class Api::V1::IssuesController < Api::V1::BaseController |
|
|
|
before_action :require_login, except: [:index, :show] |
|
|
|
before_action :require_public_and_member_above, only: [:index, :show, :create, :update, :destroy] |
|
|
|
before_action :require_login, except: [:index, :show, :show_by_id] |
|
|
|
before_action :require_public_and_member_above, only: [:index, :show, :show_by_id, :create, :update, :destroy] |
|
|
|
before_action :require_operate_above, only: [:batch_update, :batch_destroy] |
|
|
|
|
|
|
|
def index |
|
|
|
@@ -22,6 +22,12 @@ class Api::V1::IssuesController < Api::V1::BaseController |
|
|
|
|
|
|
|
before_action :load_issue, only: [:show, :update, :destroy] |
|
|
|
before_action :check_issue_operate_permission, only: [:update, :destroy] |
|
|
|
before_action :load_issue_by_id, only: [:show_by_id] |
|
|
|
|
|
|
|
def show_by_id |
|
|
|
@issue.associate_attachment_container |
|
|
|
@user_permission = current_user.present? && current_user.logged? && (@project.member?(current_user) || current_user.admin? || @issue.user == current_user) |
|
|
|
end |
|
|
|
|
|
|
|
def show |
|
|
|
@issue.associate_attachment_container |
|
|
|
@@ -70,6 +76,13 @@ class Api::V1::IssuesController < Api::V1::BaseController |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def load_issue_by_id |
|
|
|
@issue = Issue.find_by_id(params[:index]) |
|
|
|
if @issue.blank? |
|
|
|
render_not_found("疑修不存在!") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def load_issues |
|
|
|
return render_error("请输入正确的ID数组!") unless params[:ids].is_a?(Array) |
|
|
|
params[:ids].each do |id| |
|
|
|
|