Closed (fixed)
Project:
Entity Share
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Oct 2020 at 11:02 UTC
Updated:
25 Dec 2020 at 08:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
perelesnyk commentedComment #3
grimreaperHello,
Again thanks for your issues and patches.
Here is my review:
I think this should be an option because there are use cases where you want your files to be overwritten.
But an option in the Physical file import processor plugin on the 8.x-3.x. For 8.x-2.x this should stay in your custom code.
No problem to change those lines though to help developing code for such use cases.
Comment #4
perelesnyk commentedSo, do you want me to make another patch against 8.x-3.x? Will gladly do
Comment #5
grimreaperIf you can make a patch for 8.x-3.x this would be amazing :)
For 8.x-2.x, I can commit the two changed lines in JsonapiHelper if you want.
Comment #6
perelesnyk commentedHere's the patch for 8.x-3.x
Comment #7
grimreaperHello,
Thanks for the patch. Here is a quick reply and review because I currently don't have time for Entity Share (and maybe no more time until the end of the year as I am affected to some clients projects).
The import_config.schema.yml file https://git.drupalcode.org/project/entity_share/-/blob/8.x-3.x/modules/e... needs to be updated.
Also, even if not required because a default value is provided. I think an update hook to set the default value to existing config will be nice to have.
Also tests should be updated to ensure the different option values are tested.
Thanks again for your patch and your work :)
Comment #8
perelesnyk commentedAnother go on the 3.x patch - updated tests, update hook, config schema
Comment #9
perelesnyk commentedHere goes the patch, sorry
Comment #10
perelesnyk commentedGonna update the tests to pass and post an update in a while
Comment #11
perelesnyk commentedHere comes the patch with updated tests
Comment #12
grimreaperHello @perelesnyk and thanks for your work!
Updating the issue status.
I will check when I will have some time.
Comment #13
grimreaperHello @perelesnyk,
Here is my review.
I was about to say 8300. But nope, the problem is from entity_share_client_update_8201 which should be 8303... OMG, fortunately the entity_share_client_update_8201 check the previous config structure so it can be renamed.
So for this new update it should be 8304
Should it be "FALSE" instead of "0"? As it is a boolean expected.
Rename files
If a file with the same name exists, rename the imported file instead of overwriting the existing file. The imported file will be saved as filename_0 or filename_1... etc.
Does this also mean that if you have one entity with a file attached, if you import this entity twice, it will create 2 files? In this case, I think the automated test can be simplified.
Or maybe even merged in FileTest
I think you can inherit from FileTest.php to avoid duplicated code.
I think the method should be named checkFileRenamed, otherwise it is confusing I think.
TestBasicPull so you can inherit from FileTest
As there is a new option, other test classes needs to be updated to have the default configuration explicit.
Also some PHPDoc and coding standards are not OK.
I will try to manually test it and rework tests.
Comment #14
grimreaperForget about point 3 and 4, this is not the plugin name directly, only option so it is ok to have a long title.
Comment #15
grimreaperOk and point 5 is yes, even with one entity it will create new files.
So I think a warning should be added in the UI.
Comment #16
grimreaperTesting test rework.
Comment #18
grimreaperComment #19
grimreaperTests are green @perelesnyk if the last patch is ok for you it will be merged and a new release done :)
Comment #20
perelesnyk commentedLet's merge, @Grimreaper! Thank you for such a thourough review!
Comment #21
grimreaperTHanks for you reply :).
I will take a moment today.
Comment #23
grimreaperMerged!
Going to make a new release.