Merge pull request #2461 from aignatov-bio/ai-sci-4448-hide-uneditable-projects-in-quick-start-widget

Add user check to project filter in quick start widget [SCI-4448]
This commit is contained in:
Miha Mencin 2020-03-12 09:25:07 +01:00 committed by GitHub
commit c9c6d12759
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,7 @@ module Dashboard
def project_filter
projects = current_team.projects.search(current_user, false, params[:query], 1, current_team)
.where('user_projects.role <= 1')
.where(user_projects: { user_id: current_user.id, role: %i(owner normal_user) })
.select(:id, :name)
projects = projects.map { |i| { value: i.id, label: escape_input(i.name) } }
if (projects.map { |i| i[:label] }.exclude? params[:query]) && params[:query].present?