Merge pull request #4847 from artoscinote/ma_SCI_7774

Fix copying and pasting TinyMCE images [SCI-7774]
This commit is contained in:
artoscinote 2023-01-17 14:48:50 +01:00 committed by GitHub
commit c7dc9efe10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,6 +35,10 @@ class TinyMceAsset < ApplicationRecord
end
images.each do |image|
image_to_update = find_by(id: Base62.decode(image))
# if image was pasted from another object, create a copy
image_to_update = image_to_update.clone_tinymce_asset(object) if image_to_update.object != object
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)