Drag 'n Drop Inline Images Backend - WebAPI

Review Request #6617 — Created Nov. 21, 2014 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

Part of a set of changes to add support for dragging and dropping images into the markdown editor.

  • Creating a Web API for user file attachments, UserFileAttachment resource.
  • UserFileAttachment resource can be accessed at /api/users/<username>/file-attachments/<id>/
  • Users can only get/modify/delete their own UserFileAttachments. Superusers can get/modify any.
  • UserFileAttachments can be created (using POST) without an associated file, in this case the database entry will be created, and the view will return a 404.
  • UserFileAttachments can be modified (using PUT) to include a file. This can only be done to UserFileAttachments that do not already have an asosciated file.
  • When deleting a UserFileAttachment, the associated file is also deleted.

Also did some refactoring of the base_file_attachment Web API resource so that it could be extended by both user_file_attachment and review_request_file_attachment resources.

All unit tests pass after making the changes.

Extensive manual testing of UserFileAttachment Web API resource using Postman REST client:
- Testing each method (GET/POST/PUT/DELETE) for UserFileAttachment as a regular user and superuser.
- Testing local_site functionality

Added unit tests around the new UserFileAttachment WebAPI Resource.

    Loading...