|
|
|
@@ -1,7 +1,7 @@ |
|
|
|
class Api::V1::Issues::JournalsController < Api::V1::IssuesController |
|
|
|
class Api::V1::Issues::JournalsController < Api::V1::BaseController |
|
|
|
before_action :require_login, except: [:index, :children_journals] |
|
|
|
before_action :require_public_and_member_above, only: [:index, :create, :children_journals, :update, :destroy] |
|
|
|
before_action :load_issue, only: [:index, :create, :children_journals, :update, :destroy] |
|
|
|
before_action :require_public_and_member_above |
|
|
|
before_action :load_issue |
|
|
|
before_action :load_journal, only: [:children_journals, :update, :destroy] |
|
|
|
before_action :check_journal_operate_permission, only: [:update, :destroy] |
|
|
|
|
|
|
|
@@ -41,6 +41,13 @@ class Api::V1::Issues::JournalsController < Api::V1::IssuesController |
|
|
|
params.permit(:notes, :parent_id, :reply_id, :attachment_ids => []) |
|
|
|
end |
|
|
|
|
|
|
|
def load_issue |
|
|
|
@issue = @project.issues.where(project_issues_index: params[:index]).where.not(id: params[:index]).take || Issue.find_by_id(params[:index]) |
|
|
|
if @issue.blank? |
|
|
|
render_not_found("疑修不存在!") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def load_journal |
|
|
|
@journal = Journal.find_by_id(params[:id]) |
|
|
|
return render_not_found("评论不存在!") unless @journal.present? |
|
|
|
|