mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-05 14:41:53 +08:00
Merge pull request #2088 from aignatov-bio/ai-sci-3912-fix-tiny-mce-issue
Fix error handling and rubocop error [SCI-3912]
This commit is contained in:
commit
daf8d88855
4 changed files with 5 additions and 3 deletions
|
@ -24,5 +24,7 @@ module ActiveStorageConcerns
|
|||
temp_file.flush
|
||||
temp_file.rewind
|
||||
target.attach(io: temp_file, filename: blob.filename, metadata: blob.metadata)
|
||||
rescue StandardError => e
|
||||
Rails.logger.error e.message
|
||||
end
|
||||
end
|
||||
|
|
|
@ -83,7 +83,7 @@ module TinyMceImages
|
|||
end
|
||||
|
||||
def copy_unknown_tiny_mce_images
|
||||
asset_team_id = Team.find_by_object(self).id
|
||||
asset_team_id = Team.search_by_object(self).id
|
||||
return unless asset_team_id
|
||||
|
||||
object_field = Extends::RICH_TEXT_FIELD_MAPPINGS[self.class.name]
|
||||
|
|
|
@ -218,7 +218,7 @@ class Team < ApplicationRecord
|
|||
query.select(:id, :name).map { |i| { id: i[:id], name: ApplicationController.helpers.escape_input(i[:name]) } }
|
||||
end
|
||||
|
||||
def self.find_by_object(obj)
|
||||
def self.search_by_object(obj)
|
||||
find(
|
||||
case obj.class.name
|
||||
when 'Protocol'
|
||||
|
|
|
@ -47,7 +47,7 @@ class TinyMceAsset < ApplicationRecord
|
|||
end
|
||||
images.each do |image|
|
||||
image_to_update = find_by(id: Base62.decode(image))
|
||||
next if image_to_update.object || image_to_update.team_id != Team.find_by(object: object).id
|
||||
next if image_to_update.object || image_to_update.team_id != Team.search_by_object(object).id
|
||||
|
||||
image_to_update&.update(object: object, saved: true)
|
||||
create_create_marvinjs_activity(image_to_update, current_user)
|
||||
|
|
Loading…
Reference in a new issue