diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-06-26 18:31:05 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-04 10:53:39 +0200 |
commit | 04b046587fe609cd889f3fa518f08299abc61267 (patch) | |
tree | 634fc7d5e2a416950868700a82c171ff4f54239b /app/finders/pipelines_finder.rb | |
parent | cd5789415b6e561564073693243e890e79596ed2 (diff) | |
download | gitlab-ce-04b046587fe609cd889f3fa518f08299abc61267.tar.gz |
Add pipeline lists to GraphQL
This adds Keyset pagination to GraphQL lists. PoC for that is
pipelines on merge requests and projects.
When paginating a list, the base-64 encoded id of the ordering
field (in most cases the primary key) can be passed in the `before` or
`after` GraphQL argument.
Diffstat (limited to 'app/finders/pipelines_finder.rb')
-rw-r--r-- | app/finders/pipelines_finder.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/finders/pipelines_finder.rb b/app/finders/pipelines_finder.rb index 0a487839aff..a99a889a7e9 100644 --- a/app/finders/pipelines_finder.rb +++ b/app/finders/pipelines_finder.rb @@ -1,15 +1,20 @@ class PipelinesFinder - attr_reader :project, :pipelines, :params + attr_reader :project, :pipelines, :params, :current_user ALLOWED_INDEXED_COLUMNS = %w[id status ref user_id].freeze - def initialize(project, params = {}) + def initialize(project, current_user, params = {}) @project = project + @current_user = current_user @pipelines = project.pipelines @params = params end def execute + unless Ability.allowed?(current_user, :read_pipeline, project) + return Ci::Pipeline.none + end + items = pipelines items = by_scope(items) items = by_status(items) |