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.

docs/manual/webapi/2.0/errors/229-file-already-exists.rst
docs/manual/webapi/2.0/errors/index.rst
reviewboard/testing/testcase.py
reviewboard/webapi/errors.py
reviewboard/webapi/resources/base_file_attachment.py
reviewboard/webapi/resources/base_review_request_file_attachment.py
reviewboard/webapi/resources/diff_file_attachment.py
reviewboard/webapi/resources/draft_file_attachment.py
reviewboard/webapi/resources/file_attachment.py
reviewboard/webapi/resources/user.py
reviewboard/webapi/resources/user_file_attachment.py
reviewboard/webapi/tests/mimetypes.py
reviewboard/webapi/tests/test_user_file_attachment.py
reviewboard/webapi/tests/urls.py
Loading...