Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
5a2c0707
Commit
5a2c0707
authored
5 years ago
by
Gomasy
Committed by
Eugen Rochko
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Support min_id-based pagination for bookmarks (#12381)
* Support min_id-based pagination for bookmarks * Fix spec
parent
df15a2cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/api/v1/bookmarks_controller.rb
+3
-4
3 additions, 4 deletions
app/controllers/api/v1/bookmarks_controller.rb
spec/controllers/api/v1/bookmarks_controller_spec.rb
+1
-1
1 addition, 1 deletion
spec/controllers/api/v1/bookmarks_controller_spec.rb
with
4 additions
and
5 deletions
app/controllers/api/v1/bookmarks_controller.rb
+
3
−
4
View file @
5a2c0707
...
...
@@ -26,10 +26,9 @@ class Api::V1::BookmarksController < Api::BaseController
end
def
results
@_results
||=
account_bookmarks
.
paginate_by_
max_
id
(
@_results
||=
account_bookmarks
.
paginate_by_id
(
limit_param
(
DEFAULT_STATUSES_LIMIT
),
params
[
:max_id
],
params
[
:since_id
]
params_slice
(
:max_id
,
:since_id
,
:min_id
)
)
end
...
...
@@ -46,7 +45,7 @@ class Api::V1::BookmarksController < Api::BaseController
end
def
prev_path
api_v1_bookmarks_url
pagination_params
(
s
in
ce
_id:
pagination_since_id
)
unless
results
.
empty?
api_v1_bookmarks_url
pagination_params
(
m
in_id:
pagination_since_id
)
unless
results
.
empty?
end
def
pagination_max_id
...
...
This diff is collapsed.
Click to expand it.
spec/controllers/api/v1/bookmarks_controller_spec.rb
+
1
−
1
View file @
5a2c0707
...
...
@@ -64,7 +64,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do
get
:index
,
params:
{
limit:
1
}
expect
(
response
.
headers
[
'Link'
].
find_link
([
'rel'
,
'next'
]).
href
).
to
eq
"http://test.host/api/v1/bookmarks?limit=1&max_id=
#{
bookmark
.
id
}
"
expect
(
response
.
headers
[
'Link'
].
find_link
([
'rel'
,
'prev'
]).
href
).
to
eq
"http://test.host/api/v1/bookmarks?limit=1&
s
in
ce
_id=
#{
bookmark
.
id
}
"
expect
(
response
.
headers
[
'Link'
].
find_link
([
'rel'
,
'prev'
]).
href
).
to
eq
"http://test.host/api/v1/bookmarks?limit=1&
m
in_id=
#{
bookmark
.
id
}
"
end
it
'does not add pagination headers if not necessary'
do
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment