ucsd-cse110-fa23 / cse-110-project-team-20

cse-110-project-team-20 created by GitHub Classroom
0 stars 0 forks source link

[DS5-10] Fix bug where share URL is invalidated after editing recipe #229

Closed nathom closed 11 months ago

nathom commented 11 months ago

Previously, if the recipe was edited the UUID would be regenerated in some cases, invalidating previously shared URLs. This change makes the UUID a function of the recipe ID and recipe title (both of which are invariant) so that the same URL will always be generated for a given recipe.

github-actions[bot] commented 11 months ago

Code Coverage

Overall Project 76.53% :green_apple:
Files changed 100% :green_apple:


File Coverage
MongoDBRecipeRepository.java 96.56% :green_apple:
edykim commented 11 months ago

Thanks for the change. We cannot rely on id here for URL generation, because there is no real "id" there. id is just index number of recipe list, so it can be changed when something is deleted. (this was one of the decisions we made from MS1)

I can reproduce the issue as you described. The reason of this issue was at updateRecipe(id, recipe) method in CachedRecipeModel. We cached updated recipe there and missed copying over getSharedUrl() from originalRecipe. Can you check that part and update the PR?

nathom commented 11 months ago

Ok no worries. I'll make a new PR with the fix