Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
c41a8be8
Commit
c41a8be8
authored
Jan 06, 2016
by
Michi302
Committed by
Rémy Coutable
Feb 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix add_pagination_headers to keep request parameters in Link header
parent
6cffcb05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
CHANGELOG
CHANGELOG
+1
-0
lib/api/helpers.rb
lib/api/helpers.rb
+15
-5
No files found.
CHANGELOG
View file @
c41a8be8
...
@@ -19,6 +19,7 @@ v 8.5.0 (unreleased)
...
@@ -19,6 +19,7 @@ v 8.5.0 (unreleased)
- Update the ExternalIssue regex pattern (Blake Hitchcock)
- Update the ExternalIssue regex pattern (Blake Hitchcock)
- Optimized performance of finding issues to be closed by a merge request
- Optimized performance of finding issues to be closed by a merge request
- Revert "Add IP check against DNSBLs at account sign-up"
- Revert "Add IP check against DNSBLs at account sign-up"
- Fix API to keep request parameters in Link header (Michael Potthoff)
- Deprecate API "merge_request/:merge_request_id/comments". Use "merge_requests/:merge_request_id/notes" instead
- Deprecate API "merge_request/:merge_request_id/comments". Use "merge_requests/:merge_request_id/notes" instead
- Deprecate API "merge_request/:merge_request_id/...". Use "merge_requests/:merge_request_id/..." instead
- Deprecate API "merge_request/:merge_request_id/...". Use "merge_requests/:merge_request_id/..." instead
- Mark inline difference between old and new paths when a file is renamed
- Mark inline difference between old and new paths when a file is renamed
...
...
lib/api/helpers.rb
View file @
c41a8be8
...
@@ -30,7 +30,7 @@ module API
...
@@ -30,7 +30,7 @@ module API
end
end
def
sudo_identifier
()
def
sudo_identifier
()
identifier
||=
params
[
SUDO_PARAM
]
||
=
env
[
SUDO_HEADER
]
identifier
||=
params
[
SUDO_PARAM
]
||
env
[
SUDO_HEADER
]
# Regex for integers
# Regex for integers
if
!!
(
identifier
=~
/^[0-9]+$/
)
if
!!
(
identifier
=~
/^[0-9]+$/
)
...
@@ -344,12 +344,22 @@ module API
...
@@ -344,12 +344,22 @@ module API
def
pagination_links
(
paginated_data
)
def
pagination_links
(
paginated_data
)
request_url
=
request
.
url
.
split
(
'?'
).
first
request_url
=
request
.
url
.
split
(
'?'
).
first
request_params
=
params
.
clone
request_params
[
:per_page
]
=
paginated_data
.
limit_value
links
=
[]
links
=
[]
links
<<
%(<#{request_url}?page=#{paginated_data.current_page - 1}&per_page=#{paginated_data.limit_value}>; rel="prev")
unless
paginated_data
.
first_page?
links
<<
%(<#{request_url}?page=#{paginated_data.current_page + 1}&per_page=#{paginated_data.limit_value}>; rel="next")
unless
paginated_data
.
last_page?
request_params
[
:page
]
=
paginated_data
.
current_page
-
1
links
<<
%(<#{request_url}?page=1&per_page=#{paginated_data.limit_value}>; rel="first")
links
<<
%(<#{request_url}?#{request_params.to_query}>; rel="prev")
unless
paginated_data
.
first_page?
links
<<
%(<#{request_url}?page=#{paginated_data.total_pages}&per_page=#{paginated_data.limit_value}>; rel="last")
request_params
[
:page
]
=
paginated_data
.
current_page
+
1
links
<<
%(<#{request_url}?#{request_params.to_query}>; rel="next")
unless
paginated_data
.
last_page?
request_params
[
:page
]
=
1
links
<<
%(<#{request_url}?#{request_params.to_query}>; rel="first")
request_params
[
:page
]
=
paginated_data
.
total_pages
links
<<
%(<#{request_url}?#{request_params.to_query}>; rel="last")
links
.
join
(
', '
)
links
.
join
(
', '
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment