deathandmayhem / jolly-roger

Dead men tell no tales!
MIT License
19 stars 6 forks source link

Deduplicate new puzzles by URL. #2313

Open jpd236 opened 4 weeks ago

jpd236 commented 4 weeks ago

When adding a puzzle, we start a transaction to atomically check if a puzzle already exists with that URL and only add it if either no such puzzle exists or if the client indicates that duplicate URLs are allowed. In the event of a transaction failure, we delete the Google document that was created optimistically before saving the puzzle.

On the client side, we add a new checkbox to allow duplicate URLs, unchecked by default. If we encounter a duplicate URL error, we show an error indicating that the puzzle may be a dupe and telling the user what to check if the duplicate URLs are intentional.

See #2275

jpd236 commented 4 weeks ago

This should be functional, but there are some less-polished (IMO) elements as I wanted to get feedback before moving forward. At least the following: