mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-16 09:45:57 +08:00
新增:评论相关接口补足
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
class Api::V1::Issues::JournalsController < Api::V1::IssuesController
|
||||
|
||||
before_action :require_public_and_member_above, only: [:index, :create, :destroy]
|
||||
before_action :load_issue, only: [:index, :create, :destroy]
|
||||
before_action :load_journal, only: [:destroy]
|
||||
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 :load_journal, only: [:children_journals, :update, :destroy]
|
||||
|
||||
def index
|
||||
@object_results = Api::V1::Issues::Journals::ListService.call(@issue, query_params, current_user)
|
||||
@@ -13,6 +13,15 @@ class Api::V1::Issues::JournalsController < Api::V1::IssuesController
|
||||
@object_result = Api::V1::Issues::Journals::CreateService.call(@issue, journal_params, current_user)
|
||||
end
|
||||
|
||||
def children_journals
|
||||
@object_results = Api::V1::Issues::Journals::ChildrenListService.call(@issue, @journal, query_params, current_user)
|
||||
@journals = kaminari_paginate(@object_results)
|
||||
end
|
||||
|
||||
def update
|
||||
@object_result = Api::V1::Issues::Journals::UpdateService.call(@issue, @journal, journal_params, current_user)
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @journal.destroy!
|
||||
render_ok
|
||||
@@ -28,11 +37,11 @@ class Api::V1::Issues::JournalsController < Api::V1::IssuesController
|
||||
end
|
||||
|
||||
def journal_params
|
||||
params.permit(:notes, :parent_id, :attachment_ids => [])
|
||||
params.permit(:notes, :parent_id, :reply_id, :attachment_ids => [])
|
||||
end
|
||||
|
||||
def load_journal
|
||||
@journal = @issue.journals.find_by_id(params[:id])
|
||||
@journal = Journal.find_by_id(params[:id])
|
||||
return render_not_found("评论不存在!") unless @journal.present?
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user