Add support for screenshot draft updating and deleting
Review Request #1993 — Created Dec. 11, 2010 and submitted — Latest diff uploaded
This adds support for editing captions on a screenshot and deleting them. It modifies the screenshot code to track each thumbnail as an object. Previously, we would use $.screenshotThumbnail to generate a thumbnail after upload, and nothing would be done for existing thumbnails. Now $.screenshotThumbnail has been renamed to $.newScreenshotThumbnail, which later invokes the new function, $.fn.screenshotThumbnail. This new one registers events on the thumbnail (edit and delete) and hooks them up to the datastore object. One of the benefits there is that we can now delete the old, dangerous delete/ URL for screenshots (outside the API). Instead, we send an HTTP DELETE to the screenshot's resource to delete it. The Screenshot resources have been updated to fix edit/delete. This part should probably be backported to release-1.5.x.
I was able to edit captions and delete screenshots. Edit and delete events worked both for brand new screenshots, and for existing screenshots. It also passed all tests.