Fix TinyMCE issue in project export, small fixes for protocols [SCI-8199]

This commit is contained in:
Oleksii Kriuchykhin 2023-04-04 13:42:20 +02:00
parent ed9f3d49d4
commit a70d8dea74
4 changed files with 3 additions and 7 deletions

View file

@ -168,7 +168,7 @@ module AccessPermissions
def set_protocol
@protocol = current_team.protocols.includes(user_assignments: %i(user user_role)).find_by(id: params[:id])
render_404 unless @protocol
return render_404 unless @protocol
@protocol = @protocol.parent if @protocol.parent_id
end

View file

@ -58,7 +58,7 @@ module UserAssignments
return unless protocol.visible?
protocol.create_public_user_assignments!(@assigned_by)
protocol.create_or_update_public_user_assignments!(@assigned_by)
end
def assign_users_to_report(report)

View file

@ -165,7 +165,7 @@ class TinyMceAsset < ApplicationRecord
end
def clone_tinymce_asset(obj)
team_id = Team.search_by_object(object)&.id
team_id = Team.search_by_object(obj)&.id
return false unless team_id

View file

@ -47,7 +47,6 @@ class TeamImporter
def import_from_dir(import_dir)
MyModule.skip_callback(:create, :before, :create_blank_protocol)
Protocol.skip_callback(:save, :after, :update_linked_children)
Activity.skip_callback(:create, :before, :add_user)
Activity.skip_callback(:initialize, :after, :init_default_values)
@user_roles = UserRole.all
@ -151,7 +150,6 @@ class TeamImporter
puts "Imported label templates: #{@label_template_counter}"
MyModule.set_callback(:create, :before, :create_blank_protocol)
Protocol.set_callback(:save, :after, :update_linked_children)
Activity.set_callback(:create, :before, :add_user)
Activity.set_callback(:initialize, :after, :init_default_values)
end
@ -161,7 +159,6 @@ class TeamImporter
user_id)
# Remove callbacks that can cause problems when importing
MyModule.skip_callback(:create, :before, :create_blank_protocol)
Protocol.skip_callback(:save, :after, :update_linked_children)
@import_dir = import_dir
@is_template = true
@ -202,7 +199,6 @@ class TeamImporter
ensure
# Reset callbacks
MyModule.set_callback(:create, :before, :create_blank_protocol)
Protocol.set_callback(:save, :after, :update_linked_children)
end
private