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
iv
gitlab-ce
Commits
dfb4fcb6
Commit
dfb4fcb6
authored
Mar 26, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No magic numbers for issues filtering
parent
090f2344
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+5
-3
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+2
-2
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+2
-2
No files found.
app/finders/issuable_finder.rb
View file @
dfb4fcb6
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
require_relative
'projects_finder'
require_relative
'projects_finder'
class
IssuableFinder
class
IssuableFinder
NONE
=
0
attr_accessor
:current_user
,
:params
attr_accessor
:current_user
,
:params
def
execute
(
current_user
,
params
)
def
execute
(
current_user
,
params
)
...
@@ -112,7 +114,7 @@ class IssuableFinder
...
@@ -112,7 +114,7 @@ class IssuableFinder
def
by_milestone
(
items
)
def
by_milestone
(
items
)
if
params
[
:milestone_id
].
present?
if
params
[
:milestone_id
].
present?
items
=
items
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
'0'
?
nil
:
params
[
:milestone_id
]))
items
=
items
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
NONE
?
nil
:
params
[
:milestone_id
]))
end
end
items
items
...
@@ -120,7 +122,7 @@ class IssuableFinder
...
@@ -120,7 +122,7 @@ class IssuableFinder
def
by_assignee
(
items
)
def
by_assignee
(
items
)
if
params
[
:assignee_id
].
present?
if
params
[
:assignee_id
].
present?
items
=
items
.
where
(
assignee_id:
(
params
[
:assignee_id
]
==
'0'
?
nil
:
params
[
:assignee_id
]))
items
=
items
.
where
(
assignee_id:
(
params
[
:assignee_id
]
==
NONE
?
nil
:
params
[
:assignee_id
]))
end
end
items
items
...
@@ -128,7 +130,7 @@ class IssuableFinder
...
@@ -128,7 +130,7 @@ class IssuableFinder
def
by_author
(
items
)
def
by_author
(
items
)
if
params
[
:author_id
].
present?
if
params
[
:author_id
].
present?
items
=
items
.
where
(
author_id:
(
params
[
:author_id
]
==
'0'
?
nil
:
params
[
:author_id
]))
items
=
items
.
where
(
author_id:
(
params
[
:author_id
]
==
NONE
?
nil
:
params
[
:author_id
]))
end
end
items
items
...
...
app/services/issues/update_service.rb
View file @
dfb4fcb6
...
@@ -14,8 +14,8 @@ module Issues
...
@@ -14,8 +14,8 @@ module Issues
issue
.
update_nth_task
(
params
[
:task_num
].
to_i
,
false
)
issue
.
update_nth_task
(
params
[
:task_num
].
to_i
,
false
)
end
end
params
[
:assignee_id
]
=
""
if
params
[
:assignee_id
]
==
"-1"
params
[
:assignee_id
]
=
""
if
params
[
:assignee_id
]
==
IssuableFinder
::
NONE
params
[
:milestone_id
]
=
""
if
params
[
:milestone_id
]
==
"-1"
params
[
:milestone_id
]
=
""
if
params
[
:milestone_id
]
==
IssuableFinder
::
NONE
old_labels
=
issue
.
labels
.
to_a
old_labels
=
issue
.
labels
.
to_a
...
...
app/services/merge_requests/update_service.rb
View file @
dfb4fcb6
...
@@ -23,8 +23,8 @@ module MergeRequests
...
@@ -23,8 +23,8 @@ module MergeRequests
merge_request
.
update_nth_task
(
params
[
:task_num
].
to_i
,
false
)
merge_request
.
update_nth_task
(
params
[
:task_num
].
to_i
,
false
)
end
end
params
[
:assignee_id
]
=
""
if
params
[
:assignee_id
]
==
"-1"
params
[
:assignee_id
]
=
""
if
params
[
:assignee_id
]
==
IssuableFinder
::
NONE
params
[
:milestone_id
]
=
""
if
params
[
:milestone_id
]
==
"-1"
params
[
:milestone_id
]
=
""
if
params
[
:milestone_id
]
==
IssuableFinder
::
NONE
old_labels
=
merge_request
.
labels
.
to_a
old_labels
=
merge_request
.
labels
.
to_a
...
...
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