Merge pull request #2458 from aignatov-bio/ai-sci-4441-remove-uneditable-projects-in-create-task-widget

Remove uneditable projects from create task widget [SCI-4441]
This commit is contained in:
Miha Mencin 2020-03-10 12:35:32 +01:00 committed by GitHub
commit 25211dd70b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -20,7 +20,9 @@ module Dashboard
end
def project_filter
projects = current_team.projects.search(current_user, false, params[:query], 1, current_team).select(:id, :name)
projects = current_team.projects.search(current_user, false, params[:query], 1, current_team)
.where('user_projects.role <= 1')
.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?
projects = [{ value: 0, label: params[:query] }] + projects

View file

@ -95,7 +95,7 @@ class ExperimentsController < ApplicationController
@experiment.last_modified_by = current_user
if @experiment.save
experiment_annotation_notification(old_text)
experiment_annotation_notification(old_text) if old_text
activity_type = if experiment_params[:archived] == 'false'
:restore_experiment