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
6e129d02
Commit
6e129d02
authored
Mar 17, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename user attribute to current_user on search results
parent
978ae222
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+2
-2
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+4
-4
No files found.
lib/gitlab/project_search_results.rb
View file @
6e129d02
...
...
@@ -2,8 +2,8 @@ module Gitlab
class
ProjectSearchResults
<
SearchResults
attr_reader
:project
,
:repository_ref
def
initialize
(
user
,
project
,
query
,
repository_ref
=
nil
)
@
user
=
user
def
initialize
(
current_
user
,
project
,
query
,
repository_ref
=
nil
)
@
current_user
=
current_
user
@project
=
project
@repository_ref
=
if
repository_ref
.
present?
repository_ref
...
...
lib/gitlab/search_results.rb
View file @
6e129d02
module
Gitlab
class
SearchResults
attr_reader
:user
,
:query
attr_reader
:
current_
user
,
:query
# Limit search results by passed projects
# It allows us to search only for projects user has access to
attr_reader
:limit_projects
def
initialize
(
user
,
limit_projects
,
query
)
@
user
=
user
def
initialize
(
current_
user
,
limit_projects
,
query
)
@
current_user
=
current_
user
@limit_projects
=
limit_projects
||
Project
.
all
@query
=
Shellwords
.
shellescape
(
query
)
if
query
.
present?
end
...
...
@@ -59,7 +59,7 @@ module Gitlab
end
def
issues
issues
=
Issue
.
visible_to_user
(
user
).
where
(
project_id:
project_ids_relation
)
issues
=
Issue
.
visible_to_user
(
current_
user
).
where
(
project_id:
project_ids_relation
)
if
query
=~
/#(\d+)\z/
issues
=
issues
.
where
(
iid:
$1
)
...
...
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