openly-rails icon indicating copy to clipboard operation
openly-rails copied to clipboard

When I move my files from one project to another, they are not marked as removed

Open FinnWoelm opened this issue 6 years ago • 2 comments

When files/folders are moved out of project scope, they are not marked as deleted if that outside scope is also shared with [email protected].

What happens when files are added to a folder that has been moved out of scope?

When setting external_parent= to a file that is currently deleted, also mark child as deleted

FinnWoelm avatar Feb 07 '19 01:02 FinnWoelm

There are three scenarios to test here:

  • Move single file f1 from project p1 to project p2
  • Move folder f1 with files f1 and f2 from project p1 to project p2
  • Move folder f1 from project p1 to project p2 and then add file f2 to folder f1

FinnWoelm avatar Feb 11 '19 09:02 FinnWoelm

The fix for this is almost complete. We have identified all the issues and solutions:

  1. When a folder is moved out of a project, its descendants were not marked as removed, leading to orphaned records. Solution: Recursive mark_as_removed on removal
  2. When adding a file to a folder that has been moved out of a project, it would be added to both the old and the new project. Solution: When setting parent_in_branch, check if parent_in_branch is removed
  3. When moving a folder into a new project, only the folder is added and not any of its children. Solution: Trigger a recursive #pull_children when adding a new folder to a branch

Now, we just need some refactoring of the FileUpdateJob because it's becoming too big.

FinnWoelm avatar Feb 14 '19 03:02 FinnWoelm