Merge pull request #3747 from aignatov-bio/ai-sci-6338-not-all-projects-in-dropdown-for-taks-create

Change permissions for dashboard quick start modal [SCI-6338]
This commit is contained in:
Alex Kriuchykhin 2022-01-04 10:07:39 +01:00 committed by GitHub
commit 93492c6dc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@ module Dashboard
end
def project_filter
projects = Project.managable_by_user(current_user)
projects = Project.readable_by_user(current_user)
.search(current_user, false, params[:query], 1, current_team)
.select(:id, :name)
projects = projects.map { |i| { value: i.id, label: escape_input(i.name) } }
@ -39,7 +39,9 @@ module Dashboard
.search(current_user, false, params[:query], 1, current_team)
.select(:id, :name)
experiments = experiments.map { |i| { value: i.id, label: escape_input(i.name) } }
if (experiments.map { |i| i[:label] }.exclude? params[:query]) && params[:query].present?
if (experiments.map { |i| i[:label] }.exclude? params[:query]) &&
params[:query].present? &&
can_create_project_experiments?(@project)
experiments = [{ value: 0, label: params[:query] }] + experiments
end
end
@ -57,7 +59,7 @@ module Dashboard
end
def load_project
@project = current_team.projects.managable_by_user(current_user).find_by(id: params.dig(:project, :id))
@project = current_team.projects.readable_by_user(current_user).find_by(id: params.dig(:project, :id))
end
def load_experiment