Auto-fix duplicate reviews.

Review Request #898 — Created June 17, 2009 and submitted


Review Board SVN (deprecated)


Auto-fix duplicate reviews.

Under times of heavy server load, it's possible to get duplicate draft
Review objects in the database. This is harder with RC3, but still
possible. All it requires is that the databsae is under load and two
comments or reviews are created within a span of time on the server by
the same person on the same review request. This had to be manually
fixed in the database before, and caused frustration for those who hit

This problem is pretty specific to draft reviews. This change now
introduces a central function to call to get the draft review for a
review request, and if more than one review is found, it will
consolidate them into a single review and return it.
This consolidation code has been pretty well tested on an actual live
server with many duplicate reviews. There's also unit tests to make sure
that this functionality continues to work.