- Status:
- Discarded
Add webAPI resources for archived and muted review requests
Review Request #7087 — Created March 19, 2015 and submitted
This adds webAPI resources for the creation and deletion of archived and muted review requests.
Each resource is a child of the User resource and inherits from a base archived resource. Resources accept POST and DELETE requests, both of which modify ReviewRequestVisit database entries accordingly.
Added standard POST and DELETE tests to reviewboard.webapi.tests. All tests passed.
Description | From | Last Updated |
---|---|---|
Col: 80 E501 line too long (82 > 79 characters) |
reviewbot | |
Needs an added_in field. This should be 2.5.x (until we know when it is going to land). |
brennie | |
Docstring needs more information. Blank line between these. |
brennie | |
This doesn't appear to be used. |
brennie | |
Fields should use hyphens instead of underscores. |
brennie | |
Archive instead of watch? |
brennie | |
Needs a docstring. |
brennie | |
This should be (ReviewRequest.DoesNotExist, User.DoesNotExist). ObjectDoesNotExist is much too generic here. The same goes for other places you use ObjectDoesNotExist. |
brennie | |
We should check if the user has view permissions for the review request, otherwise we leak information that a review … |
brennie | |
Needs a docstring. |
brennie | |
Needs an added_in = '2.5.x' field. |
brennie | |
I don't believe this is used. |
brennie | |
Needs a docstring. |
brennie | |
Needs a docstring. |
brennie | |
'ObjectDoesNotExist' imported but unused |
reviewbot | |
Is there any model that these WebAPI resources should be based on? Also, you can add model_parent_key to point to … |
VT VTL-Developer | |
undefined name 'ReviewRequest' |
reviewbot | |
undefined name 'User' |
reviewbot | |
undefined name 'ReviewRequest' |
reviewbot | |
undefined name 'User' |
reviewbot | |
Col: 23 W292 no newline at end of file |
reviewbot | |
Col: 67 W292 no newline at end of file |
reviewbot | |
Col: 61 W292 no newline at end of file |
reviewbot | |
Should be in alphabetical order. |
chipx86 | |
'archived_list_mimetype' imported but unused |
reviewbot | |
'get_archived_review_request_item_url' imported but unused |
reviewbot | |
local variable 'archived_rsp' is assigned to but never used |
reviewbot | |
Col: 53 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 49 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 67 W292 no newline at end of file |
reviewbot | |
Col: 61 W292 no newline at end of file |
reviewbot | |
'archived_list_mimetype' imported but unused |
reviewbot | |
Col: 53 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 49 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 67 W292 no newline at end of file |
reviewbot | |
Col: 61 W292 no newline at end of file |
reviewbot | |
'archived_list_mimetype' imported but unused |
reviewbot | |
Col: 53 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 49 E128 continuation line under-indented for visual indent |
reviewbot | |
local variable 'visit' is assigned to but never used |
reviewbot | |
Creates -> Create |
JY jyuen | |
This should probably check if user is an instance of basestring instead, to better communicate intentions. |
chipx86 | |
This can be one statement. |
chipx86 | |
List -> Lists manipulates -> manipulate |
JY jyuen | |
Marks -> Mark |
JY jyuen | |
Deletes -> Delete |
JY jyuen | |
You can save a query in the common case by doing: visit, is_new = ReviewRequestVisit.objects.get_or_create( user=user, review_request=review_request, defaults={ 'visibility': self.visibility, … |
chipx86 | |
Same note as above. |
chipx86 | |
Lists -> List manipulates -> manipulate |
JY jyuen | |
That's not really true, though. This is returning review requests. |
chipx86 | |
Marks -> Mark |
JY jyuen | |
Deletes -> Delete |
JY jyuen | |
Col: 9 E303 too many blank lines (2) |
reviewbot |
- Status:
- Re-opened
- Summary:
-
Added visibility field to ReviewRequestVisitAdds webAPI resources for archived and muted review requests.
- Description:
-
~ The visibility field has three states: visible (V), archived (A), and muted (M). A database evolution, reviewrequestvisit_visibility, was also written for this change.
~ Added webAPI resources for archived and muted review requests.
- - Added filtering archived and muted requests in the dashboard
- - Based on the state of the dashboard's show_archived attribute, review requests that are either archived or muted will be filtered from the queryset.
- - Added Archive and Mute buttons in a Hide dropdown menu in a review request view
- - - - dded button handlers that communicate with the webAPI.
- - Augmented the UserSession WatchedItem (renamed StoredItem) to also include archivedReviewRequests and mutedReviewRequests. The only difference these objects are their URL and their error messages (addError and removeError methods were added in order to set different errors). Review request visibility is now passed as context data to templates.
- - Added dashboard button that toggles between showing and hiding hiden review requests.
- - - - Added banners for archiving and muting review requests.
- - Archived and Muted banners appear when a review request has been archived or muted. Each banner contains a button that can unarchive or unmute the review request. All of these events trigger a page refresh.
- - Added webAPI resources for archived and muted revuew requests.
Each resource is a child of the User resource. Resources accept POST and DELETE requests, both of which modify ReviewRequestVisit database entries accordingly.
- Commit:
-
e23d735023f66b21435440e294c28d424b80c4c2
- Diff:
-
Revision 1 (+482 -52)
- Summary:
-
Add webAPI resources for archived and muted review requests.[WIP] Add webAPI resources for archived and muted review requests.
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/user.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/resources/archived_review_request.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/user.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/resources/archived_review_request.py
-
The
MutedReviewRequestResource
andArchivedReviewRequestResource
are very similar and they should maybe be refactored to inherit from a base class that does most of the machinery. Then the subclasses can implement the methods via the@augment_method_from
decorator. -
-
-
-
-
-
-
-
This should be
(ReviewRequest.DoesNotExist, User.DoesNotExist)
.ObjectDoesNotExist
is much too generic here.The same goes for other places you use
ObjectDoesNotExist
. -
We should check if the user has view permissions for the review request, otherwise we leak information that a review request that they do not have permissions to view exists.
Same elsewhere.
-
-
-
-
-
- Description:
-
Added webAPI resources for archived and muted review requests.
~ Each resource is a child of the User resource. Resources accept POST and DELETE requests, both of which modify ReviewRequestVisit database entries accordingly.
~ Each resource is a child of the User resource and inherits from a base hidden resource. Resources accept POST and DELETE requests, both of which modify ReviewRequestVisit database entries accordingly.
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/resources/base_hidden_object.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py Ignored Files: reviewboard/templates/base.html Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/resources/base_hidden_object.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py Ignored Files: reviewboard/templates/base.html
-
-
-
-
-
-
- Summary:
-
[WIP] Add webAPI resources for archived and muted review requests.[WIP] Add webAPI resources for archived and muted review requests
- Depends On:
-
-
Tool: Pyflakes Processed Files: reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/resources/base_archived_object.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/resources/base_archived_object.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py
-
-
-
-
-
-
-
-
-
- Diff:
-
Revision 5 (+337)
-
Tool: Pyflakes Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py Tool: PEP8 Style Checker Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py
-
-
-
-
-
- Depends On:
-
- Diff:
Revision 6 (+337)
-
Tool: Pyflakes Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py Tool: PEP8 Style Checker Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py
-
-
-
-
-
- Description:
-
Added webAPI resources for archived and muted review requests.
~ Each resource is a child of the User resource and inherits from a base hidden resource. Resources accept POST and DELETE requests, both of which modify ReviewRequestVisit database entries accordingly.
~ Each resource is a child of the User resource and inherits from a base archived resource. Resources accept POST and DELETE requests, both of which modify ReviewRequestVisit database entries accordingly.
- Diff:
-
Revision 7 (+334)
-
Tool: Pyflakes Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py Tool: PEP8 Style Checker Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py
- Summary:
-
[WIP] Add webAPI resources for archived and muted review requestsAdd webAPI resources for archived and muted review requests
- Description:
-
~ Added webAPI resources for archived and muted review requests.
~ This adds webAPI resources for the creation and deletion of archived and muted review requests.
Each resource is a child of the User resource and inherits from a base archived resource. Resources accept POST and DELETE requests, both of which modify ReviewRequestVisit database entries accordingly.
- Testing Done:
-
+ Added standard POST and DELETE tests to reviewboard.webapi.tests. All tests passed.
- Diff:
-
Revision 8 (+337)
-
Tool: Pyflakes Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py Tool: PEP8 Style Checker Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py
-
- Groups:
-
- Diff:
Revision 9 (+336)
-
Tool: PEP8 Style Checker Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py Tool: Pyflakes Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py
-
-
-
This should probably check if
user
is an instance ofbasestring
instead, to better communicate intentions. -
-
You can save a query in the common case by doing:
visit, is_new = ReviewRequestVisit.objects.get_or_create( user=user, review_request=review_request, defaults={ 'visibility': self.visibility, }) if not is_new and visit.visibility != self.visibility: visit.visibility = self.visibility visit.save(update_fields=['visibility'])
-
-
- Diff:
-
Revision 10 (+342 -1)
-
Tool: Pyflakes Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py Tool: PEP8 Style Checker Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py
-
- Diff:
-
Revision 11 (+341 -1)
-
Tool: PEP8 Style Checker Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py Tool: Pyflakes Processed Files: reviewboard/testing/testcase.py reviewboard/webapi/tests/test_archived_review_request.py reviewboard/webapi/resources/muted_review_request.py reviewboard/webapi/tests/urls.py reviewboard/webapi/tests/mimetypes.py reviewboard/webapi/resources/user.py reviewboard/webapi/resources/archived_review_request.py reviewboard/webapi/resources/base_archived_object.py