Admin Area -> Projects: Filter for visibility levels broken
If the projects visibility filter (one or more checkbox) is set for visibility_levels[]
and the search is started gitlab returns a 500.
This happens because the sql column visibility_level
exists in the table projects
and also in namespaces
. Only projects.visibility_level
Should be searched.
- Error Message: ActionView::Template::Error (PG::AmbiguousColumn: ERROR: column reference "visibility_level" is ambiguous
- Admin Path: /admin/projects
- Tested In: 8.6.1 and 8.6.2
-
Screen of Section(before error):
- See a full trace here:
Started GET "/admin/projects?utf8=%E2%9C%93&name=&namespace_id=&visibility_levels%5B%5D=10&sort=" for 217.249.54.117 at 2016-03-31 22:14:56 +0200
Processing by Admin::ProjectsController#index as HTML
Parameters: {"utf8"=>"✓", "name"=>"", "namespace_id"=>"", "visibility_levels"=>["10"], "sort"=>""}
Completed 500 Internal Server Error in 66ms (ActiveRecord: 2.4ms)
ActionView::Template::Error (PG::AmbiguousColumn: ERROR: column reference "visibility_level" is ambiguous
LINE 1: ...mespaces"."id" = "projects"."namespace_id" WHERE (visibility...
^
: SELECT COUNT(DISTINCT "projects"."id") FROM "projects" LEFT OUTER JOIN "namespaces" ON "namespaces"."id" = "projects"."namespace_id" WHERE (visibility_level IN ('10')) AND "projects"."archived" = $1):
46: %section.col-md-9
47: .panel.panel-default
48: .panel-heading
49: Projects (#{@projects.total_count})
50: .controls
51: .dropdown.inline
52: %button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'}
app/views/admin/projects/index.html.haml:49:in `_app_views_admin_projects_index_html_haml___4588687194058008111_47020380'
lib/gitlab/middleware/go.rb:16:in `call'