ChangeControl visibility takes draft into account

isVisible() in ChangeControl now considers whether or not the change
is a draft. As ReviewDb is needed to see whether or not a user has
visibility for a certain change, this change also refactors most
uses of isVisible() to also pass in ReviewDb. As a bonus, much of the
notification routines seem to work as wanted, due to the new visibility
checks.

Change-Id: I4c3b068413e4db30edb23f498f61048142cb6713
This commit is contained in:
Jason Tsay
2011-08-09 15:31:32 -07:00
committed by Mohan Zhang
parent 8f713a4ea9
commit 2c18a88823
15 changed files with 112 additions and 55 deletions

View File

@@ -260,11 +260,13 @@ public class SetReviewersCommand extends BaseCommand {
try {
if (change != null
&& inProject(change)
&& changeControlFactory.controlFor(change).isVisible()) {
&& changeControlFactory.controlFor(change).isVisible(db)) {
matched.add(change.getId());
}
} catch (NoSuchChangeException e) {
// Ignore this change.
} catch (OrmException e) {
log.warn("Error reading change " + change.getId(), e);
}
}