Closed Bug 652028 Opened 13 years ago Closed 13 years ago

Don't allow reviewing a persona which has already been reviewed

Categories

(Websites Graveyard :: getpersonas.com, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: MattN, Assigned: MattN)

References

()

Details

Attachments

(1 file)

Similar to the fix for Bug 619088.

Check the state of the persona record in the DB on page load and on form submit to make sure that it hasn't already been reviewed.  The UPDATE query to the DB should also check the state with the WHERE clause so that it only updates unreviewed personas.

Multiple reviews of the same persona can be confusing since each review sends an email.  The check on page load will also save reviewers time from reviewing a persona that has already been reviewed.
Assignee: nobody → bsavage
This is a major issue for our reviewers right now so getting this fixed would be great.
server/lib/review.php: 
* add constants for persona statuses to make code easier to read and grep.
* add pending_already_reviewed function.

server/lib/storage.php: 
* use new constants
* and WHERE condition to SQL for accept and reject to ensure persona is only changed from the expected status.
* Return the number of affected rows for accept/reject so that callers know whether they succeeded.

server/templates/user_error.php: 
* return proper HTTP status code to make quick_reject ajax handle the error message.

server/admin/pending.php:
* check status multiple times while reviewing
* make quick_reject AJAX handle already reviewed personas
Assignee: bsavage → mmn100+bmo
Status: NEW → ASSIGNED
Attachment #532481 - Flags: review?(bsavage)
The code looks decent, but I wasn't quite sure how to test this. Matt, can you give me some pointers on how you tested it?
There are three checks to test:
1) Open up 2 tabs with the same pending review page for a specific persona.  Perform a review action in one tab and then perform another in the other tab.  The second request will display. The link should return you to the pending queue.

2) Open up a review page for a persona and review it.  Then from the pending queue, open up the same persona to review.  The error should be displayed instead of the review page.  The link should return you to the pending queue.

3) Check at DB insert time: 
Comment out admin/pending.php on line 90 so that the tests checking the return values from the review function will be hit:
90			pending_already_reviewed();
Then just repeat the steps for test #1 above.
Comment on attachment 532481 [details] [diff] [review]
v.1 check current status before reviewing pending

Review of attachment 532481 [details] [diff] [review]:
-----------------------------------------------------------------

Worked for me in dev, and seems to look generally good.
Attachment #532481 - Flags: review?(bsavage) → review+
Committed in r93018

Things to verify are in Comment 5 (#1 & #2)
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Websites → Websites Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: