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
Tatuya Kamada
gitlab-ce
Commits
dac9b421
Commit
dac9b421
authored
May 19, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix outer join when filtering milestones
parent
45e516b8
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
10 deletions
+15
-10
CHANGELOG
CHANGELOG
+1
-0
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+2
-2
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-0
spec/features/issues/filter_by_milestone_spec.rb
spec/features/issues/filter_by_milestone_spec.rb
+4
-4
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+2
-0
spec/features/merge_requests/filter_by_milestone_spec.rb
spec/features/merge_requests/filter_by_milestone_spec.rb
+4
-4
No files found.
CHANGELOG
View file @
dac9b421
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.9.0 (unreleased)
v 8.9.0 (unreleased)
- Redesign navigation for project pages
- Redesign navigation for project pages
- Use gitlab-shell v3.0.0
- Use gitlab-shell v3.0.0
- Fix issues filter when ordering by milestone
v 8.8.2 (unreleased)
v 8.8.2 (unreleased)
- Fix Error 500 when accessing application settings due to nil disabled OAuth sign-in sources
- Fix Error 500 when accessing application settings due to nil disabled OAuth sign-in sources
...
...
app/finders/issuable_finder.rb
View file @
dac9b421
...
@@ -250,12 +250,12 @@ class IssuableFinder
...
@@ -250,12 +250,12 @@ class IssuableFinder
def
by_milestone
(
items
)
def
by_milestone
(
items
)
if
milestones?
if
milestones?
if
filter_by_no_milestone?
if
filter_by_no_milestone?
items
=
items
.
where
(
milestone_id:
[
-
1
,
nil
])
items
=
items
.
left_joins_milestones
.
where
(
milestone_id:
[
-
1
,
nil
])
elsif
filter_by_upcoming_milestone?
elsif
filter_by_upcoming_milestone?
upcoming_ids
=
Milestone
.
upcoming_ids_by_projects
(
projects
)
upcoming_ids
=
Milestone
.
upcoming_ids_by_projects
(
projects
)
items
=
items
.
left_joins_milestones
.
where
(
milestone_id:
upcoming_ids
)
items
=
items
.
left_joins_milestones
.
where
(
milestone_id:
upcoming_ids
)
else
else
items
=
items
.
left_joins_milestones
.
where
(
milestones:
{
title:
params
[
:milestone_title
]
}
)
items
=
items
.
with_milestone
(
params
[
:milestone_title
]
)
if
projects
if
projects
items
=
items
.
where
(
milestones:
{
project_id:
projects
})
items
=
items
.
where
(
milestones:
{
project_id:
projects
})
...
...
app/models/concerns/issuable.rb
View file @
dac9b421
...
@@ -31,6 +31,7 @@ module Issuable
...
@@ -31,6 +31,7 @@ module Issuable
scope
:unassigned
,
->
{
where
(
"assignee_id IS NULL"
)
}
scope
:unassigned
,
->
{
where
(
"assignee_id IS NULL"
)
}
scope
:of_projects
,
->
(
ids
)
{
where
(
project_id:
ids
)
}
scope
:of_projects
,
->
(
ids
)
{
where
(
project_id:
ids
)
}
scope
:of_milestones
,
->
(
ids
)
{
where
(
milestone_id:
ids
)
}
scope
:of_milestones
,
->
(
ids
)
{
where
(
milestone_id:
ids
)
}
scope
:with_milestone
,
->
(
title
)
{
left_joins_milestones
.
where
(
milestones:
{
title:
title
})
}
scope
:opened
,
->
{
with_state
(
:opened
,
:reopened
)
}
scope
:opened
,
->
{
with_state
(
:opened
,
:reopened
)
}
scope
:only_opened
,
->
{
with_state
(
:opened
)
}
scope
:only_opened
,
->
{
with_state
(
:opened
)
}
scope
:only_reopened
,
->
{
with_state
(
:reopened
)
}
scope
:only_reopened
,
->
{
with_state
(
:reopened
)
}
...
@@ -45,6 +46,7 @@ module Issuable
...
@@ -45,6 +46,7 @@ module Issuable
scope
:references_project
,
->
{
references
(
:project
)
}
scope
:references_project
,
->
{
references
(
:project
)
}
scope
:non_archived
,
->
{
join_project
.
where
(
projects:
{
archived:
false
})
}
scope
:non_archived
,
->
{
join_project
.
where
(
projects:
{
archived:
false
})
}
delegate
:name
,
delegate
:name
,
:email
,
:email
,
to: :author
,
to: :author
,
...
...
spec/features/issues/filter_by_milestone_spec.rb
View file @
dac9b421
...
@@ -15,14 +15,14 @@ feature 'Issue filtering by Milestone', feature: true do
...
@@ -15,14 +15,14 @@ feature 'Issue filtering by Milestone', feature: true do
end
end
context
'filters by upcoming milestone'
,
js:
true
do
context
'filters by upcoming milestone'
,
js:
true
do
it
'should show issues with no expiry'
do
it
'should
not
show issues with no expiry'
do
create
(
:issue
,
project:
project
)
create
(
:issue
,
project:
project
)
create
(
:issue
,
project:
project
,
milestone:
milestone
)
create
(
:issue
,
project:
project
,
milestone:
milestone
)
visit_issues
(
project
)
visit_issues
(
project
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
2
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
0
)
end
end
it
'should show issues in future'
do
it
'should show issues in future'
do
...
@@ -36,7 +36,7 @@ feature 'Issue filtering by Milestone', feature: true do
...
@@ -36,7 +36,7 @@ feature 'Issue filtering by Milestone', feature: true do
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
end
end
it
'should show issues in past'
do
it
'should
not
show issues in past'
do
milestone
=
create
(
:milestone
,
project:
project
,
due_date:
Date
.
yesterday
)
milestone
=
create
(
:milestone
,
project:
project
,
due_date:
Date
.
yesterday
)
create
(
:issue
,
project:
project
)
create
(
:issue
,
project:
project
)
create
(
:issue
,
project:
project
,
milestone:
milestone
)
create
(
:issue
,
project:
project
,
milestone:
milestone
)
...
@@ -44,7 +44,7 @@ feature 'Issue filtering by Milestone', feature: true do
...
@@ -44,7 +44,7 @@ feature 'Issue filtering by Milestone', feature: true do
visit_issues
(
project
)
visit_issues
(
project
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
2
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
0
)
end
end
end
end
...
...
spec/features/issues_spec.rb
View file @
dac9b421
...
@@ -185,12 +185,14 @@ describe 'Issues', feature: true do
...
@@ -185,12 +185,14 @@ describe 'Issues', feature: true do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
sort_value_recently_created
)
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
sort_value_recently_created
)
expect
(
first_issue
).
to
include
(
'baz'
)
expect
(
first_issue
).
to
include
(
'baz'
)
expect
(
last_issue
).
to
include
(
'foo'
)
end
end
it
'sorts by oldest'
do
it
'sorts by oldest'
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
sort_value_oldest_created
)
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
sort_value_oldest_created
)
expect
(
first_issue
).
to
include
(
'foo'
)
expect
(
first_issue
).
to
include
(
'foo'
)
expect
(
last_issue
).
to
include
(
'baz'
)
end
end
it
'sorts by most recently updated'
do
it
'sorts by most recently updated'
do
...
...
spec/features/merge_requests/filter_by_milestone_spec.rb
View file @
dac9b421
...
@@ -21,14 +21,14 @@ feature 'Merge Request filtering by Milestone', feature: true do
...
@@ -21,14 +21,14 @@ feature 'Merge Request filtering by Milestone', feature: true do
end
end
context
'filters by upcoming milestone'
,
js:
true
do
context
'filters by upcoming milestone'
,
js:
true
do
it
'should show issues with no expiry'
do
it
'should
not
show issues with no expiry'
do
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
create
(
:merge_request
,
:simple
,
source_project:
project
,
milestone:
milestone
)
create
(
:merge_request
,
:simple
,
source_project:
project
,
milestone:
milestone
)
visit_merge_requests
(
project
)
visit_merge_requests
(
project
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
2
)
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
0
)
end
end
it
'should show issues in future'
do
it
'should show issues in future'
do
...
@@ -42,7 +42,7 @@ feature 'Merge Request filtering by Milestone', feature: true do
...
@@ -42,7 +42,7 @@ feature 'Merge Request filtering by Milestone', feature: true do
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
1
)
end
end
it
'should show issues in past'
do
it
'should
not
show issues in past'
do
milestone
=
create
(
:milestone
,
project:
project
,
due_date:
Date
.
yesterday
)
milestone
=
create
(
:milestone
,
project:
project
,
due_date:
Date
.
yesterday
)
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
create
(
:merge_request
,
:simple
,
source_project:
project
,
milestone:
milestone
)
create
(
:merge_request
,
:simple
,
source_project:
project
,
milestone:
milestone
)
...
@@ -50,7 +50,7 @@ feature 'Merge Request filtering by Milestone', feature: true do
...
@@ -50,7 +50,7 @@ feature 'Merge Request filtering by Milestone', feature: true do
visit_merge_requests
(
project
)
visit_merge_requests
(
project
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
2
)
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
0
)
end
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