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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
ff671366
Commit
ff671366
authored
Feb 16, 2019
by
Nermin Vehabovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added: Include order by ID desc for tie breakers in pagination
parent
3967412f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
6 deletions
+13
-6
lib/api/helpers.rb
lib/api/helpers.rb
+9
-1
lib/api/issues.rb
lib/api/issues.rb
+1
-2
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+1
-1
lib/api/notes.rb
lib/api/notes.rb
+1
-1
lib/api/users.rb
lib/api/users.rb
+1
-1
No files found.
lib/api/helpers.rb
View file @
ff671366
...
...
@@ -393,7 +393,15 @@ module API
# rubocop: disable CodeReuse/ActiveRecord
def
reorder_projects
(
projects
)
projects
.
reorder
(
params
[
:order_by
]
=>
params
[
:sort
])
projects
.
reorder
(
order_options_with_tie_breaker
)
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
order_options_with_tie_breaker
{
params
[
:order_by
]
=>
params
[
:sort
]}.
tap
do
|
order
|
order
[
'id'
]
||=
'desc'
end
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
lib/api/issues.rb
View file @
ff671366
...
...
@@ -29,8 +29,7 @@ module API
issues
=
IssuesFinder
.
new
(
current_user
,
args
).
execute
.
preload
(
:assignees
,
:labels
,
:notes
,
:timelogs
,
:project
,
:author
,
:closed_by
)
issues
.
reorder
(
args
[
:order_by
]
=>
args
[
:sort
])
issues
.
reorder
(
order_options_with_tie_breaker
)
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
lib/api/merge_requests.rb
View file @
ff671366
...
...
@@ -38,7 +38,7 @@ module API
args
[
:scope
]
=
args
[
:scope
].
underscore
if
args
[
:scope
]
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
,
args
).
execute
.
reorder
(
args
[
:order_by
]
=>
args
[
:sort
]
)
.
reorder
(
order_options_with_tie_breaker
)
merge_requests
=
paginate
(
merge_requests
)
.
preload
(
:source_project
,
:target_project
)
...
...
lib/api/notes.rb
View file @
ff671366
...
...
@@ -39,7 +39,7 @@ module API
# at the DB query level (which we cannot in that case), the current
# page can have less elements than :per_page even if
# there's more than one page.
raw_notes
=
noteable
.
notes
.
with_metadata
.
reorder
(
params
[
:order_by
]
=>
params
[
:sort
]
)
raw_notes
=
noteable
.
notes
.
with_metadata
.
reorder
(
order_options_with_tie_breaker
)
notes
=
# paginate() only works with a relation. This could lead to a
# mismatch between the pagination headers info and the actual notes
...
...
lib/api/users.rb
View file @
ff671366
...
...
@@ -26,7 +26,7 @@ module API
# rubocop: disable CodeReuse/ActiveRecord
def
reorder_users
(
users
)
if
params
[
:order_by
]
&&
params
[
:sort
]
users
.
reorder
(
params
[
:order_by
]
=>
params
[
:sort
]
)
users
.
reorder
(
order_options_with_tie_breaker
)
else
users
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