forked from Gitlink/forgeplus
Merge branch 'develop' into standalone_develop
This commit is contained in:
commit
a0dcc289c8
|
@ -2,7 +2,7 @@ class Api::V1::Projects::Pulls::JournalsController < Api::V1::Projects::Pulls::B
|
|||
|
||||
def index
|
||||
@journals = Api::V1::Projects::Pulls::Journals::ListService.call(@project, @pull_request, params, current_user)
|
||||
@journals = kaminari_paginate(@journals)
|
||||
@journals = @journals.limit(200)
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -1248,6 +1248,7 @@ await octokit.request('GET /api/v1/yystopf/ceshi_commit/pulls/3/journals.json')
|
|||
|need_respond |否| |bool |是否需要回应|
|
||||
|state |否| |string |状态, opened: 开启的, resolved: 已解决的, disabled: 无效的|
|
||||
|parent_id |否| |integer|父评论ID|
|
||||
|path |否| |string |评论文件路径|
|
||||
|sort_by |否|created_on|string |排序字段 created_on: 创建时间, updated_on: 更新时间|
|
||||
|sort_direction |否|asc |string |排序类型 desc: 倒序, asc: 正序|
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Api::V1::Projects::Pulls::Journals::ListService < ApplicationService
|
||||
include ActiveModel::Model
|
||||
|
||||
attr_reader :project, :pull_request, :keyword, :review_id, :need_respond, :state, :parent_id, :sort_by, :sort_direction, :user
|
||||
attr_reader :project, :pull_request, :keyword, :review_id, :need_respond, :state, :parent_id, :path, :sort_by, :sort_direction, :user
|
||||
attr_accessor :queried_journals
|
||||
|
||||
validates :sort_by, inclusion: {in: Journal.column_names, message: '请输入正确的SortBy'}
|
||||
|
@ -19,6 +19,7 @@ class Api::V1::Projects::Pulls::Journals::ListService < ApplicationService
|
|||
@parent_id = params[:parent_id]
|
||||
@sort_by = params[:sort_by] || 'created_on'
|
||||
@sort_direction = params[:sort_direction] || 'asc'
|
||||
@path = params[:path]
|
||||
@user = user
|
||||
end
|
||||
|
||||
|
@ -41,6 +42,7 @@ class Api::V1::Projects::Pulls::Journals::ListService < ApplicationService
|
|||
journals = journals.where(review_id: review_id) if review_id.present?
|
||||
journals = journals.where(need_respond: need_respond) if need_respond.present?
|
||||
journals = journals.where(state: state) if state.present?
|
||||
journals = journals.where(path: path) if path.present?
|
||||
|
||||
q = journals.ransack(notes_cont: keyword)
|
||||
scope = q.result.includes(:user, :resolveer, review: [:reviewer, pull_request: :issue])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
json.total_count @journals.total_count
|
||||
json.total_count @journals.count
|
||||
json.journals @journals.each do |journal|
|
||||
json.partial! 'api/v1/projects/pulls/journals/simple_detail', journal: journal
|
||||
end
|
|
@ -15072,6 +15072,13 @@ http://localhost:3000/api/v1/yystopf/ceshi/pulls/1/reviews.json
|
|||
<td>父评论ID</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>path</td>
|
||||
<td>否</td>
|
||||
<td></td>
|
||||
<td>string</td>
|
||||
<td>评论文件路径</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sort_by</td>
|
||||
<td>否</td>
|
||||
<td>created_on</td>
|
||||
|
|
Loading…
Reference in New Issue