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
Boxiang Sun
gitlab-ce
Commits
dcae1cc9
Commit
dcae1cc9
authored
Jul 17, 2018
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add avatar_url attr to the response of the autocomplete endpoint
parent
7f0431dd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+4
-2
spec/helpers/search_helper_spec.rb
spec/helpers/search_helper_spec.rb
+14
-0
No files found.
app/helpers/search_helper.rb
View file @
dcae1cc9
...
@@ -105,7 +105,8 @@ module SearchHelper
...
@@ -105,7 +105,8 @@ module SearchHelper
category:
"Groups"
,
category:
"Groups"
,
id:
group
.
id
,
id:
group
.
id
,
label:
"
#{
search_result_sanitize
(
group
.
full_name
)
}
"
,
label:
"
#{
search_result_sanitize
(
group
.
full_name
)
}
"
,
url:
group_path
(
group
)
url:
group_path
(
group
),
avatar_url:
group
.
avatar_url
||
''
}
}
end
end
end
end
...
@@ -119,7 +120,8 @@ module SearchHelper
...
@@ -119,7 +120,8 @@ module SearchHelper
id:
p
.
id
,
id:
p
.
id
,
value:
"
#{
search_result_sanitize
(
p
.
name
)
}
"
,
value:
"
#{
search_result_sanitize
(
p
.
name
)
}
"
,
label:
"
#{
search_result_sanitize
(
p
.
full_name
)
}
"
,
label:
"
#{
search_result_sanitize
(
p
.
full_name
)
}
"
,
url:
project_path
(
p
)
url:
project_path
(
p
),
avatar_url:
p
.
avatar_url
||
''
}
}
end
end
end
end
...
...
spec/helpers/search_helper_spec.rb
View file @
dcae1cc9
...
@@ -55,6 +55,20 @@ describe SearchHelper do
...
@@ -55,6 +55,20 @@ describe SearchHelper do
expect
(
search_autocomplete_opts
(
project
.
name
).
size
).
to
eq
(
1
)
expect
(
search_autocomplete_opts
(
project
.
name
).
size
).
to
eq
(
1
)
end
end
it
"includes the required project attrs"
do
project
=
create
(
:project
,
namespace:
create
(
:namespace
,
owner:
user
))
result
=
search_autocomplete_opts
(
project
.
name
).
first
expect
(
result
.
keys
).
to
match_array
(
%i[category id value label url avatar_url]
)
end
it
"includes the required group attrs"
do
create
(
:group
).
add_owner
(
user
)
result
=
search_autocomplete_opts
(
"gro"
).
first
expect
(
result
.
keys
).
to
match_array
(
%i[category id label url avatar_url]
)
end
it
"does not include the public group"
do
it
"does not include the public group"
do
group
=
create
(
:group
)
group
=
create
(
:group
)
expect
(
search_autocomplete_opts
(
group
.
name
).
size
).
to
eq
(
0
)
expect
(
search_autocomplete_opts
(
group
.
name
).
size
).
to
eq
(
0
)
...
...
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