In this PR, I prohibited users from being able to delete any of the labels they place in tutorial except for the latest, erroneous one that they placed. I did this by adding a currentLabelId field in the Onboarding.js file in the frontend, and comparing the id of the label being deleted against it to see if the deletion was valid. The label only got deleted if it had the same id as the most recent label placed.
Before/After screenshots (if applicable)
BEFORE
Here we can delete the first label instead since there's no restrictions on what labels we can delete:
AFTER
Since you're only allowed to delete the most recent label, the only thing you can do now is delete it and re-place it appropriately:
Testing instructions
Fire up tutorial
Label 1 label
For the next label, be wildly inaccurate
Try to delete the first label when prompted to delete a label (nothing should happen when you press the x button)
Try to delete the latest label now (it should delete successfully and move on with the tutorial!)
Things to check before submitting the PR
[x] I've written a descriptive PR title.
[x] I've added/updated comments for large or confusing blocks of code.
Resolves #2634
In this PR, I prohibited users from being able to delete any of the labels they place in tutorial except for the latest, erroneous one that they placed. I did this by adding a currentLabelId field in the Onboarding.js file in the frontend, and comparing the id of the label being deleted against it to see if the deletion was valid. The label only got deleted if it had the same id as the most recent label placed.
Before/After screenshots (if applicable)
BEFORE
Here we can delete the first label instead since there's no restrictions on what labels we can delete:
AFTER
Since you're only allowed to delete the most recent label, the only thing you can do now is delete it and re-place it appropriately:
Testing instructions
Things to check before submitting the PR