Patch #26622
closedCopy version attachments (i.e. Files) along with the versions on project copy
Added by Holger Just about 7 years ago. Updated over 6 years ago.
Description
When copying a project and opting to also copy versions, the attached files (i.e. the content of the "Files" tab of the source project) is not copied along.
The attached patch fixes this and also copies the version attachments.
Files
0002-Copy-version-attachments-i.e.-Files-along-with-the-v.patch (1.92 KB) 0002-Copy-version-attachments-i.e.-Files-along-with-the-v.patch | Holger Just, 2017-08-04 18:55 | ||
0003-Copy-project-attachments.patch (1.68 KB) 0003-Copy-project-attachments.patch | Holger Just, 2017-08-04 18:59 | ||
modules-to-copy@2x.png (20.5 KB) modules-to-copy@2x.png | Go MAEDA, 2017-08-05 09:18 | ||
0004-Clarify-that-copying-versions-with-a-project-also-co.patch (3.08 KB) 0004-Clarify-that-copying-versions-with-a-project-also-co.patch | Holger Just, 2017-08-09 10:47 | ||
copy_files_and_versions.png (36.6 KB) copy_files_and_versions.png | Holger Just, 2017-08-09 10:52 |
Related issues
Updated by Holger Just about 7 years ago
- File 0002-Copy-version-attachments-i.e.-Files-along-with-the-v.patch 0002-Copy-version-attachments-i.e.-Files-along-with-the-v.patch added
Turns out, there was a slight bug in the tests. Attached is the working patch. The first version can be deleted / disregarded.
Updated by Holger Just about 7 years ago
Similarly to the version attachments, it is also possible to upload files directly to a project in the Files tab. We should always copy those attachments along. This is implemented by the attached patch.
Since we are deduplicating attachments in disk already, copying these attachments is basically free anyways.
Updated by Jan from Planio www.plan.io about 7 years ago
- File deleted (
0001-Copy-version-attachments-i.e.-Files-along-with-the-v.patch)
Updated by Jan from Planio www.plan.io about 7 years ago
- Target version set to Candidate for next minor release
Updated by Go MAEDA about 7 years ago
- File modules-to-copy@2x.png modules-to-copy@2x.png added
I think it would be better to have a checkbox like as follows on ProjectsController#copy page. Maybe users sometimes exclude Files module when they copy a project.
Updated by Holger Just about 7 years ago
This could easily work for file directly attached to the project.
For files attached to versions, we can only copy them if the versions are also copied to have a valid reference. Besides this not fitting well into the existing code, we would then have to find a way to handle people opting to copy files but not versions.
The simplest solution could be do not copy version-attached files in that case (which would probably be surprising for people not being accustomed to the details of Redmine's data model). Alternatively, we could also try to enforce the selection on the UI with javascript (but would still have to handle this somehow on the server anyway). In any case, I'm afraid this gets out of hand pretty quickly implementation-wise...
Maybe, we can just improve the wording so show
[ ] Versions (2) and Files
instead of only
[ ] Versions (2)
today.
What do you think?
Updated by Go MAEDA about 7 years ago
I think it is confusing to always copy files along with versions for ordinary users because many users don't know the data structure of Redmine.
Besides, it is very problematic when there are dozens of files in the Files module and the user don't want to copy those files. The user have to click the trash icon dozens of times to delete all files after copying a project.
In my opinion, we should implement a feature to delete multiple files at once in Files module when this patch is merged.
Updated by Holger Just about 7 years ago
Go MAEDA wrote:
In my opinion, we should implement a feature to delete multiple files at once in Files module when this patch is merged.
Absolutely, that in itself is a good idea, regardless of whether this patch is merged or not.
Still, right now there is no way to copy the files along with a project. To maintain consistency with all the other objects being copied, we should make sure to also copy attachments in all cases along with their parent objects.
Given that the most common use-case for copying projects is to create a new copy of a template project (rather than random copies of existing heavily-used projects), I think it's not that suprising that files are also copied along. Yes, the data structure is non-obvious to most users (along with the general distinction between "Files" and "Documents"), hence my proposal to change the wording to make it at least obvious what is happening when the checkbox is enabled.
Updated by Go MAEDA about 7 years ago
- Target version changed from Candidate for next minor release to 4.1.0
Holger, thank you for your explanation. I have agreed with your opinion that the common use case of this feature is to copy a template project after reading #26622#note-8.
hence my proposal to change the wording to make it at least obvious what is happening when the checkbox is enabled.
It makes sense. I am setting target version to 4.1.0. Could you attach a patch to change the wording?
Updated by Holger Just about 7 years ago
- File 0004-Clarify-that-copying-versions-with-a-project-also-co.patch 0004-Clarify-that-copying-versions-with-a-project-also-co.patch added
- File copy_files_and_versions.png copy_files_and_versions.png added
Thank you Maeda-san. I have attached a patch to change the wording for English and German. The copy project screen now looks like this (with the patch from #26621 applied):
Updated by Go MAEDA over 6 years ago
- Related to Feature #10282: Copy wiki attachments on project copy added
Updated by Go MAEDA over 6 years ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Target version changed from 4.1.0 to 4.0.0
Committed the patch series. Thank you for improving Redmine.