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
Jérome Perrin
gitlab-ce
Commits
159f959b
Commit
159f959b
authored
Apr 19, 2016
by
Rémy Coutable
Committed by
Robert Speicher
Apr 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move due_date sort scopes to Issue and fix CHANGELOG
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
6cdf4acd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
CHANGELOG
CHANGELOG
+3
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+1
-3
app/models/concerns/sortable.rb
app/models/concerns/sortable.rb
+0
-4
app/models/issue.rb
app/models/issue.rb
+12
-0
No files found.
CHANGELOG
View file @
159f959b
...
...
@@ -189,7 +189,9 @@ v 8.6.1
- Fixes issue with assign milestone not loading milestone list. !3346
- Fix an issue causing the Dashboard/Milestones page to be blank. !3348
v 8.6.0 (unreleased)
v 8.6.0
- Add ability to move issue to another project
- Prevent tokens in the import URL to be showed by the UI
- Fix bug where wrong commit ID was being used in a merge request diff to show old image (Stan Hu)
- Add confidential issues
- Bump gitlab_git to 9.0.3 (Stan Hu)
...
...
app/finders/issuable_finder.rb
View file @
159f959b
...
...
@@ -114,7 +114,7 @@ class IssuableFinder
end
def
due_date?
params
[
:due_date
].
present?
params
[
:due_date
].
present?
&&
klass
.
column_names
.
include?
(
'due_date'
)
end
def
filter_by_no_due_date?
...
...
@@ -305,8 +305,6 @@ class IssuableFinder
end
def
by_due_date
(
items
)
return
items
unless
klass
.
column_names
.
include?
(
'due_date'
)
if
due_date?
if
filter_by_no_due_date?
items
=
items
.
without_due_date
...
...
app/models/concerns/sortable.rb
View file @
159f959b
...
...
@@ -18,8 +18,6 @@ module Sortable
scope
:order_updated_asc
,
->
{
reorder
(
updated_at: :asc
)
}
scope
:order_name_asc
,
->
{
reorder
(
name: :asc
)
}
scope
:order_name_desc
,
->
{
reorder
(
name: :desc
)
}
scope
:order_due_date_asc
,
->
{
reorder
(
"issues.due_date IS NULL, issues.due_date ASC"
)
}
scope
:order_due_date_desc
,
->
{
reorder
(
"issues.due_date IS NULL, issues.due_date DESC"
)
}
end
module
ClassMethods
...
...
@@ -33,8 +31,6 @@ module Sortable
when
'created_desc'
then
order_created_desc
when
'id_desc'
then
order_id_desc
when
'id_asc'
then
order_id_asc
when
'due_date_asc'
,
'due_date_desc'
column_names
.
include?
(
'due_date'
)
?
send
(
"order_
#{
method
}
"
)
:
all
else
all
end
...
...
app/models/issue.rb
View file @
159f959b
...
...
@@ -46,6 +46,9 @@ class Issue < ActiveRecord::Base
scope
:open_for
,
->
(
user
)
{
opened
.
assigned_to
(
user
)
}
scope
:in_projects
,
->
(
project_ids
)
{
where
(
project_id:
project_ids
)
}
scope
:order_due_date_asc
,
->
{
reorder
(
'issues.due_date IS NULL, issues.due_date ASC'
)
}
scope
:order_due_date_desc
,
->
{
reorder
(
'issues.due_date IS NULL, issues.due_date DESC'
)
}
state_machine
:state
,
initial: :opened
do
event
:close
do
transition
[
:reopened
,
:opened
]
=>
:closed
...
...
@@ -89,6 +92,15 @@ class Issue < ActiveRecord::Base
@link_reference_pattern
||=
super
(
"issues"
,
/(?<issue>\d+)/
)
end
def
self
.
sort
(
method
)
case
method
.
to_s
when
'due_date_asc'
then
order_due_date_asc
when
'due_date_desc'
then
order_due_date_desc
else
super
end
end
def
to_reference
(
from_project
=
nil
)
reference
=
"
#{
self
.
class
.
reference_prefix
}#{
iid
}
"
...
...
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