Skip to content
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

Fix to prevent from moving folders in sub-folders #1277

Merged
merged 12 commits into from
Jul 16, 2021

Conversation

Tbaut
Copy link
Collaborator

@Tbaut Tbaut commented Jul 15, 2021

closes #1276

My helper function involves some JS tricks that I commented, let me know if it's not clear.

@render
Copy link

render bot commented Jul 15, 2021

@render
Copy link

render bot commented Jul 15, 2021

@render
Copy link

render bot commented Jul 15, 2021

@github-actions github-actions bot added the Type: Bug Fix Added to PRs if they are addressing a bug label Jul 15, 2021
@Tbaut Tbaut added the Status: Review Needed 👀 Added to PRs when they need more review label Jul 15, 2021
Copy link
Contributor

@FSM1 FSM1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like there is something going wrong with the logic here:
image

See the screenshot above where I am trying to move /another parent into /parent but not being allowed to even though there is nothing that should be preventing the move. i.e. after the move the path should be

|-parent
|--Another parent
|--child of parent

@Tbaut
Copy link
Collaborator Author

Tbaut commented Jul 15, 2021

Ah right, nice catch, I don't allow to move the folder into any subfolder of the current path. I'll adapt.

@Tbaut
Copy link
Collaborator Author

Tbaut commented Jul 15, 2021

Ok this is turning into some dark magic.. I will probably not understand half of it any more in 2 weeks, hence the comments.
I tested the weirdest things and it look all right to me now.

@Tbaut Tbaut requested a review from FSM1 July 15, 2021 15:19
@asnaith
Copy link
Contributor

asnaith commented Jul 15, 2021

I just tested out the fix on Render (for Storage). It looks good for subfolders now, it's not possible to move a parent into a subfolder.

However, on a related note I just noticed you can move the parent into itself, "Folder1" to "Folder1", and loose access in the UI. Do you want to address in this PR or should I create a separate issue?

Video:

move-folder-issue.mov

Copy link
Contributor

@tanmoyAtb tanmoyAtb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing,
A few comments to resolve some of the problems.

@Tbaut Tbaut requested a review from tanmoyAtb July 15, 2021 20:50
@Tbaut Tbaut enabled auto-merge (squash) July 15, 2021 20:51
@asnaith
Copy link
Contributor

asnaith commented Jul 15, 2021

Top level seems good now, I cannot move a parent into a child folder or itself.

I know this is expanding the scope of the original ticket but I've found a couple of additional issues that are related to this, regarding child folders. You can cause a child folder to become unreachable in two scenarios

  • When moving it into the parent folder that it is already in
  • When when moving it to itself

Can we show the same error when trying to move child folders in this way too?

@Tbaut
Copy link
Collaborator Author

Tbaut commented Jul 16, 2021

When moving it into the parent folder that it is already in
When when moving it to itself

I can't reproduce this, it's not allowed for me. Can you do another round of check @tanmoyAtb and @FSM1 when you have the chance? I'd love to get to the bottom of it today :)

Here's what I'm testing, at the root, and in a sub-folder, and it looks good.

move.mp4

@tanmoyAtb
Copy link
Contributor

For me both of these cases are working as expected,
I'm not allowed to,

  • move into one's parent folder
  • move onto itself

Copy link
Contributor

@tanmoyAtb tanmoyAtb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested out all the cases I could think of,
working for me 💯

Copy link
Contributor

@FSM1 FSM1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also tested all the scenarios I could think of and seem unable to break it 🎉

@Tbaut Tbaut merged commit feaf24c into dev Jul 16, 2021
@Tbaut Tbaut deleted the fix/tbaut-fix-folder-in-folder-1267 branch July 16, 2021 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review Needed 👀 Added to PRs when they need more review Type: Bug Fix Added to PRs if they are addressing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChainSafe Storage: Folder can be moved into it's subfolder
5 participants