Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OHR Support
Manage
Activity
Members
Labels
Plan
Issues
97
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
OHR Support
Commits
dbd6dfc6
Commit
dbd6dfc6
authored
13 years ago
by
Gregor Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
[
#373
] Refactoring auto_completes#issues action
hoping to make it more intention revealing
parent
85092129
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/controllers/auto_completes_controller.rb
+8
-8
8 additions, 8 deletions
app/controllers/auto_completes_controller.rb
with
8 additions
and
8 deletions
app/controllers/auto_completes_controller.rb
+
8
−
8
View file @
dbd6dfc6
...
...
@@ -4,18 +4,18 @@ class AutoCompletesController < ApplicationController
def
issues
@issues
=
[]
q
=
params
[
:q
].
to_s
query
=
(
params
[
:scope
]
==
"all"
&&
Setting
.
cross_project_issue_relations?
)
?
Issue
:
@project
.
issues
if
q
.
match
(
/^\d+$/
)
@issues
<<
query
.
visible
.
find_by_id
(
q
.
to_i
)
end
unless
q
.
blank?
@issues
+=
query
.
visible
.
find
(
:all
,
if
q
.
present?
query
=
(
params
[
:scope
]
==
"all"
&&
Setting
.
cross_project_issue_relations?
)
?
Issue
:
@project
.
issues
@issues
|=
query
.
visible
.
find_all_by_id
(
q
.
to_i
)
if
q
=~
/^\d+$/
@issues
|=
query
.
visible
.
find
(
:all
,
:limit
=>
10
,
:order
=>
"
#{
Issue
.
table_name
}
.id ASC"
,
:conditions
=>
[
"LOWER(
#{
Issue
.
table_name
}
.subject) LIKE :q OR CAST(
#{
Issue
.
table_name
}
.id AS CHAR(13)) LIKE :q"
,
{
:q
=>
"%
#{
q
.
downcase
}
%"
}])
end
@issues
.
compact!
@issues
.
uniq!
render
:layout
=>
false
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment