mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-18 14:49:31 +08:00
Merge pull request #4822 from sboursen-scinote/sb_SCI_7732
Archiving task from experiment table - connections are lost [SCI-7732]
This commit is contained in:
commit
3ae7da91e0
1 changed files with 13 additions and 1 deletions
|
|
@ -442,6 +442,8 @@ class ExperimentsController < ApplicationController
|
||||||
next unless can_archive_my_module?(my_module)
|
next unless can_archive_my_module?(my_module)
|
||||||
|
|
||||||
my_module.transaction do
|
my_module.transaction do
|
||||||
|
connect_my_modules_before_archive(my_module)
|
||||||
|
|
||||||
my_module.archive!(current_user)
|
my_module.archive!(current_user)
|
||||||
log_my_module_activity(:archive_module, my_module)
|
log_my_module_activity(:archive_module, my_module)
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|
@ -517,7 +519,7 @@ class ExperimentsController < ApplicationController
|
||||||
def check_read_permissions
|
def check_read_permissions
|
||||||
current_team_switch(@experiment.project.team) if current_team != @experiment.project.team
|
current_team_switch(@experiment.project.team) if current_team != @experiment.project.team
|
||||||
render_403 unless can_read_experiment?(@experiment) ||
|
render_403 unless can_read_experiment?(@experiment) ||
|
||||||
@experiment.archived? && can_read_archived_experiment?(@experiment)
|
(@experiment.archived? && can_read_archived_experiment?(@experiment))
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_canvas_read_permissions
|
def check_canvas_read_permissions
|
||||||
|
|
@ -630,4 +632,14 @@ class ExperimentsController < ApplicationController
|
||||||
records
|
records
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def connect_my_modules_before_archive(my_module)
|
||||||
|
return if my_module.my_modules.empty? || my_module.my_module_antecessors.empty?
|
||||||
|
|
||||||
|
my_module.my_modules.each do |destination_my_module|
|
||||||
|
my_module.my_module_antecessors.each do |source_my_module|
|
||||||
|
Connection.create!(input_id: destination_my_module.id, output_id: source_my_module.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue