-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update evidence screenshot links after node merge #1291
base: nodes-merge/table-caching
Are you sure you want to change the base?
Conversation
target_node.evidence_ids.each do |evidence_id| | ||
evidence = Evidence.find(evidence_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about
target_node.evidence_ids.each do |evidence_id| | |
evidence = Evidence.find(evidence_id) | |
target_node.evidence.each do |evidence| |
@@ -90,15 +92,33 @@ def update_properties | |||
end | |||
|
|||
def copy_attachments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is including the AttachmentsCopier
that defines a copy_attachments
method but this also defines a method with the same name. Should we differentiate the 2 and use a different name?
end | ||
end | ||
end | ||
|
||
def updated_record_content(record_content, full_screenshot_path, new_attachment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated_record_content
doesn't quite describe what this method does. What about update_attachment_link
or update_attachment_reference
, or something else?
def update_attachment_references | ||
target_node.evidence_ids.each do |evidence_id| | ||
evidence = Evidence.find(evidence_id) | ||
evidence.content.scan(Attachment::SCREENSHOT_REGEX).each do |screenshot_path| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very similar to the AttachmentsCopier#copy_attachments
method. Is there something we can reuse from there?
Summary
After merging nodes, screenshots in the Evidence content are left pointing to the old node. The attachments are copied over but the links are not updated. This means users face validation errors and have to manually update all screenshot references after merging nodes.
Check List