Commit 757e92d5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Prevent duplicate method names in helpers

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent ffbbccb7
...@@ -49,7 +49,7 @@ module SearchHelper ...@@ -49,7 +49,7 @@ module SearchHelper
# Autocomplete results for the current project, if it's defined # Autocomplete results for the current project, if it's defined
def project_autocomplete def project_autocomplete
if @project && @project.repository.exists? && @project.repository.root_ref if @project && @project.repository.exists? && @project.repository.root_ref
prefix = simple_sanitize(@project.name_with_namespace) prefix = search_result_sanitize(@project.name_with_namespace)
ref = @ref || @project.repository.root_ref ref = @ref || @project.repository.root_ref
[ [
...@@ -74,7 +74,7 @@ module SearchHelper ...@@ -74,7 +74,7 @@ module SearchHelper
def groups_autocomplete(term, limit = 5) def groups_autocomplete(term, limit = 5)
current_user.authorized_groups.search(term).limit(limit).map do |group| current_user.authorized_groups.search(term).limit(limit).map do |group|
{ {
label: "group: #{simple_sanitize(group.name)}", label: "group: #{search_result_sanitize(group.name)}",
url: group_path(group) url: group_path(group)
} }
end end
...@@ -84,7 +84,7 @@ module SearchHelper ...@@ -84,7 +84,7 @@ module SearchHelper
def projects_autocomplete(term, limit = 5) def projects_autocomplete(term, limit = 5)
current_user.authorized_projects.search_by_title(term).non_archived.limit(limit).map do |p| current_user.authorized_projects.search_by_title(term).non_archived.limit(limit).map do |p|
{ {
label: "project: #{simple_sanitize(p.name_with_namespace)}", label: "project: #{search_result_sanitize(p.name_with_namespace)}",
url: project_path(p) url: project_path(p)
} }
end end
...@@ -94,13 +94,13 @@ module SearchHelper ...@@ -94,13 +94,13 @@ module SearchHelper
def public_projects_autocomplete(term, limit = 5) def public_projects_autocomplete(term, limit = 5)
Project.public_or_internal_only(current_user).search_by_title(term).non_archived.limit(limit).map do |p| Project.public_or_internal_only(current_user).search_by_title(term).non_archived.limit(limit).map do |p|
{ {
label: "project: #{simple_sanitize(p.name_with_namespace)}", label: "project: #{search_result_sanitize(p.name_with_namespace)}",
url: project_path(p) url: project_path(p)
} }
end end
end end
def simple_sanitize(str) def search_result_sanitize(str)
Sanitize.clean(str) Sanitize.clean(str)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment