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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
6ac89382
Commit
6ac89382
authored
Jun 17, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Error 500 when attempting to sort merge requests by weight
Fixes #673
parent
cda8de63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+2
-1
spec/finders/issues_finder_spec.rb
spec/finders/issues_finder_spec.rb
+16
-0
spec/finders/merge_requests_finder_spec.rb
spec/finders/merge_requests_finder_spec.rb
+6
-0
No files found.
app/finders/issuable_finder.rb
View file @
6ac89382
...
...
@@ -295,7 +295,8 @@ class IssuableFinder
end
def
weights?
params
[
:weight
].
present?
&&
params
[
:weight
]
!=
Issue
::
WEIGHT_ALL
params
[
:weight
].
present?
&&
params
[
:weight
]
!=
Issue
::
WEIGHT_ALL
&&
klass
.
column_names
.
include?
(
'weight'
)
end
def
filter_by_no_weight?
...
...
spec/finders/issues_finder_spec.rb
View file @
6ac89382
...
...
@@ -34,6 +34,22 @@ describe IssuesFinder do
expect
(
issues
).
to
contain_exactly
(
issue1
,
issue2
,
issue3
)
end
context
'sort by issues with no weight'
do
let
(
:params
)
{
{
weight:
Issue
::
WEIGHT_NONE
}
}
it
'returns all issues'
do
expect
(
issues
).
to
contain_exactly
(
issue1
,
issue2
,
issue3
)
end
end
context
'sort by issues with any weight'
do
let
(
:params
)
{
{
weight:
Issue
::
WEIGHT_ANY
}
}
it
'returns all issues'
do
expect
(
issues
).
to
be_empty
end
end
context
'filtering by assignee ID'
do
let
(
:params
)
{
{
assignee_id:
user
.
id
}
}
...
...
spec/finders/merge_requests_finder_spec.rb
View file @
6ac89382
...
...
@@ -29,5 +29,11 @@ describe MergeRequestsFinder do
merge_requests
=
MergeRequestsFinder
.
new
(
user
,
params
).
execute
expect
(
merge_requests
.
size
).
to
eq
(
1
)
end
it
'should ignore sorting by weight'
do
params
=
{
project_id:
project1
.
id
,
scope:
'authored'
,
state:
'opened'
,
weight:
Issue
::
WEIGHT_ANY
}
merge_requests
=
MergeRequestsFinder
.
new
(
user
,
params
).
execute
expect
(
merge_requests
.
size
).
to
eq
(
1
)
end
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