Fixed moving notes with images#1805
Merged
Conversation
added 2 commits
April 12, 2018 21:20
Contributor
|
I've submitted a fix for the problem based on the refactoring of the attachment management -> #1860 I think i've also fixed the issue you mentioned as 'limitation' with the fix :) |
sosukesuzuki
requested changes
Apr 24, 2018
Contributor
sosukesuzuki
left a comment
There was a problem hiding this comment.
Please confirm my review!:smile:
browser/main/lib/dataApi/moveNote.js
Outdated
| .then(function moveImages (noteData) { | ||
| const searchImagesRegex = /!\[.*?]\(\s*?\/:storage\/(.*\.\S*?)\)/gi | ||
| let match = searchImagesRegex.exec(noteData.content) | ||
| if (oldStorage.path === newStorage.path) { |
Contributor
There was a problem hiding this comment.
I think that we should reduce nests.
So I want you to use the style like this:
if (oldStorage.path === newStorage.path) return noteData
// next ...
Author
There was a problem hiding this comment.
Thanks, great review! I like your solution, it is much cleaner.
Member
|
hey @sosukesuzuki , could you review it again? |
sosukesuzuki
approved these changes
Apr 26, 2018
Member
|
Merged. Thank you for your awesome contribution @frankkanis :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1788
How it works:
Moving note from one folder to another folder at the same storage -> don't touch the images
Moving note from one folder to another folder at different storages -> copy the images to the new storage, delete the images from the old storage
Limits:
If the same image is referenced in multiple notes at the old storage, moving only one note (with the image) will result in deleting the image at the old storage. But this is another bug.