Allow comment creators to fix/drop
Review Request #3837 — Created Feb. 3, 2013 and discarded
Allow comment creators to fix/drop So far, only the owner of the review request can fix/drop issues. This commit allows the creator of a comment to fix/close it themselves. Fixes #2888. API: Allow comment *creators* to fix/drop UI: Show Fixed/Drop buttons for issue creators
Tried with local instance: - review owner can still fix/drop issues - issue creators can successfully fix/drop issues - other people can not fix/drop issues as before All tests pass. I updated the following tests to work again and also test if the above three properties hold: - test_update_diff_comment_issue_status - test_update_screenshot_comment_issue_status
Description | From | Last Updated |
---|---|---|
*Should* always succeed, but that doesn't mean it will. Always check and log. Nitpick, but comments should always end with … |
chipx86 | |
This should be using comment.get_review(), which we also call below. We should only fetch that once. |
chipx86 | |
I feel we're putting too much business logic now in the template tag. Ideally, this should all be determined in … |
chipx86 | |
We're determining a bool and then later converting to a string. Just do an if statement here and set interactive … |
chipx86 | |
I think it is better to prepare a variable's value first then return the variable, instead of having a if … |
GR gregwym | |
Col: 80 E501 line too long (88 > 79 characters) |
reviewbot | |
You're doing this twice. |
chipx86 | |
Col: 80 E501 line too long (84 > 79 characters) |
reviewbot | |
This logic is different from the above logic. Don't check this stuff here, or compute comment_creator, or any of that. … |
chipx86 | |
Col: 16 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 16 E128 continuation line under-indented for visual indent |
reviewbot | |
Docstrings must follow this convention: """One-line summary Multi-line description. """ or: """One-line summary""" Line must be < 80 chars. |
chipx86 | |
This information should be explained in the docstring. |
chipx86 | |
A tip that Django won't tell you about but will save a query is to not compare against things like … |
chipx86 | |
The first two checks are free, and the third can have up to 3 queries (for review, review request, and … |
chipx86 | |
Not a fan of this syntax. It's a bit weird to read, and it makes it harder to add any … |
chipx86 | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
"a user" |
chipx86 | |
This is a new test. |
chipx86 | |
Trailing period. |
chipx86 | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Also a new test. |
chipx86 | |
Too much copy/paste. Let's limit the check to where we're putting the boolean. (It's okay for that to exceed 80 … |
chipx86 | |
Col: 80 E501 line too long (95 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (105 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (95 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (166 > 79 characters) |
reviewbot | |
We don't usually have a whole post-condition description, since that makes the test output extremely long. I'd say just do … |
chipx86 | |
Col: 80 E501 line too long (95 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (206 > 79 characters) |
reviewbot | |
"... with owner trying to change a published issue" |
chipx86 | |
Col: 80 E501 line too long (94 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
This is a new test. |
chipx86 | |
Col: 80 E501 line too long (161 > 79 characters) |
reviewbot | |
"... with changing an issue and no permission" |
chipx86 | |
Col: 80 E501 line too long (94 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (86 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (101 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (106 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (101 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (172 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (101 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (212 > 79 characters) |
reviewbot | |
Similar comments to above. In fact, at this point, all my previous comments repeat. |
chipx86 | |
Col: 80 E501 line too long (100 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (167 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (100 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (92 > 79 characters) |
reviewbot |
-
-
*Should* always succeed, but that doesn't mean it will. Always check and log. Nitpick, but comments should always end with a period. (And be valid sentences.)
-
This should be using comment.get_review(), which we also call below. We should only fetch that once.
-
I feel we're putting too much business logic now in the template tag. Ideally, this should all be determined in a can_change_issue_status() function in the BaseComment model.
-
We're determining a bool and then later converting to a string. Just do an if statement here and set interactive to be 'true' or 'false' from that.
-
-
This logic is different from the above logic. Don't check this stuff here, or compute comment_creator, or any of that. Instead, use the aforementioned new function.
- Change Summary:
-
Adressed all comments, factored out logic into BaseComment.can_change_issue_status()
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/models.py Ignored Files:
-
-
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/models.py Ignored Files:
- Change Summary:
-
Fix and expand tests
- Description:
-
~ [WIP] Allow comment creators to fix/drop
~ Allow comment creators to fix/drop
So far, only the owner of the review request can fix/drop issues.
This commit allows the creator of a comment to fix/close it themselves.
Fixes #2888. API: Allow comment creators to fix/drop
UI: Show Fixed/Drop buttons for issue creators
- Testing Done:
-
Tried with local instance:
- review owner can still fix/drop issues - issue creators can successfully fix/drop issues - other people can not fix/drop issues as before ~ [WIP] 2 tests fail:
~ All tests pass.
+ + + + I updated the following tests to work again and also test if the above three properties hold:
- test_update_diff_comment_issue_status - User 'doc' can close an issue, the test thinks they shouldn't be able to - test_update_screenshot_comment_issue_status - - This should have its own test, but that is quite an effort as our fixtures do not contain open issues that could be fixed/dropped.
- A full "add review request - add issue - owner fix issue" webapi test would make more sense anyway, but this is not done yet.
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/tests.py reviewboard/webapi/resources.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/models.py Ignored Files:
-
-
-
-
Docstrings must follow this convention: """One-line summary Multi-line description. """ or: """One-line summary""" Line must be < 80 chars.
-
-
A tip that Django won't tell you about but will save a query is to not compare against things like review_request.submitter. Instead, compare the IDs ('pk' variable). So: if user.pk == self.get_review().user_id: On top of this, the users_allowed_change trick is cute, but inefficient. We'll fetch both objects up-front, meaning we introduce 2 SQL queries, always. Instead, we should check each one individually, so that optimistically, we only have one query. We should start the check with the user that is most likely going to be making the change. For most uses out there, this is going to be the review request's submitter, so check that first.
-
The first two checks are free, and the third can have up to 3 queries (for review, review request, and submitter). We should do the first two checks first, and if they fail, bail.
-
Not a fan of this syntax. It's a bit weird to read, and it makes it harder to add any logic to that without awkward wrapping. IN general, I prefer a standard if/else instead. Now in this case, the fact that this was computing "true" and "false" was wrong. That means this code knows exactly how it's going to be used in the template (as a JavaScript value). Instead, this should pass the bool, and the template should be converting to the right value.
-
-
-
-
- Change Summary:
-
Massive test refactoring + split up diff and screenshot tests so that it is easier to add my new tests about who can modify issues.
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/tests.py reviewboard/webapi/resources.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/models.py Ignored Files: reviewboard/templates/reviews/comment_issue.html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Looking good, but I want to go for more consistency with the new tests and our existing ones. While your new ones are very descriptive, we don't really need that level of descriptiveness in the test strings. What I'd recommend is having all the extra precondition/postcondition explanation be comments at the top of the function. That keeps the test output more scannable, and yet makes it more clear what's expected in the test functions when they're read (if something fails, for instance).
-
Too much copy/paste. Let's limit the check to where we're putting the boolean. (It's okay for that to exceed 80 chars.)
-
We don't usually have a whole post-condition description, since that makes the test output extremely long. I'd say just do "... with trying to change an unpublished issue"
-
-
-
-