decomp.me icon indicating copy to clipboard operation
decomp.me copied to clipboard

Prevent duplicate identical forks

Open ethteck opened this issue 4 years ago • 0 comments

We should handle a couple of scenarios regarding forks to prevent abuse and confusion:

Prevent forking your own unmodified fork

  • If you have a fork B of scratch A, you shouldn't be allowed to fork B unless B is different from A. There's no reason for a person to create a fork of their own unmodified fork.

Frontend: Disable the fork button with hover-over text explaining you can't fork your own unmodified fork Backend: Return a http failure code if this is attempted

Prevent duplicate identical forks from the same parent

  • If you have a fork B of a scratch A that is identical to A, trying to fork from A again should take you to B (with a message indicating you already have "this" fork that you're trying to make) rather than making a C fork identical to B. Only if B is different from A, should the C fork creation be allowed.

Frontend: Change the toast for fork "creation" to say "switched to your existing unmodified fork" if you're trying to create a duplicate unmodified fork Backend: Instead of creating the new fork, return the existing one and signal to the front-end to use the other toast message (or move the toast message entirely into the response obect?)

A test should be added for both of these cases as well.

ethteck avatar Sep 04 '21 02:09 ethteck