Add user check to project filter in quick start widget

This commit is contained in:
aignatov-bio 2020-03-11 14:51:21 +01:00
parent 26b687f2e6
commit b898f03767

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?