diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2018-02-28 12:16:29 +0100 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2018-03-05 14:10:32 +0100 |
commit | 168ff28506dfe66a13a6c1bc5e3b772445a5bd18 (patch) | |
tree | b0a3ba4fa4771669bc5209503c39e8e8ac65b799 /app/finders | |
parent | cbefd38f9c71cc2346b83c4050b03c9cb702864a (diff) | |
download | gitlab-ce-168ff28506dfe66a13a6c1bc5e3b772445a5bd18.tar.gz |
Adds updated_at filter to issues and merge_requests API
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 12 | ||||
-rw-r--r-- | app/finders/issues_finder.rb | 4 | ||||
-rw-r--r-- | app/finders/merge_requests_finder.rb | 4 |
3 files changed, 20 insertions, 0 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 9dd6634b38f..b2d4f9938ff 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -19,6 +19,10 @@ # non_archived: boolean # iids: integer[] # my_reaction_emoji: string +# created_after: datetime +# created_before: datetime +# updated_after: datetime +# updated_before: datetime # class IssuableFinder prepend FinderWithCrossProjectAccess @@ -79,6 +83,7 @@ class IssuableFinder def filter_items(items) items = by_scope(items) items = by_created_at(items) + items = by_updated_at(items) items = by_state(items) items = by_group(items) items = by_search(items) @@ -283,6 +288,13 @@ class IssuableFinder end end + def by_updated_at(items) + items = items.updated_after(params[:updated_after]) if params[:updated_after].present? + items = items.updated_before(params[:updated_before]) if params[:updated_before].present? + + items + end + def by_state(items) case params[:state].to_s when 'closed' diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index d65c620e75a..2a27ff0e386 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -17,6 +17,10 @@ # my_reaction_emoji: string # public_only: boolean # due_date: date or '0', '', 'overdue', 'week', or 'month' +# created_after: datetime +# created_before: datetime +# updated_after: datetime +# updated_before: datetime # class IssuesFinder < IssuableFinder CONFIDENTIAL_ACCESS_LEVEL = Gitlab::Access::REPORTER diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb index 068ae7f8c89..64dc1e6af0f 100644 --- a/app/finders/merge_requests_finder.rb +++ b/app/finders/merge_requests_finder.rb @@ -19,6 +19,10 @@ # my_reaction_emoji: string # source_branch: string # target_branch: string +# created_after: datetime +# created_before: datetime +# updated_after: datetime +# updated_before: datetime # class MergeRequestsFinder < IssuableFinder def klass |