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

@@ -401,11 +401,11 @@ public abstract class ChangeEmail extends OutgoingEmail {
}
}
protected boolean isVisibleTo(final Account.Id to) {
protected boolean isVisibleTo(final Account.Id to) throws OrmException {
return projectState == null
|| change == null
|| projectState.controlFor(args.identifiedUserFactory.create(to))
.controlFor(change).isVisible();
.controlFor(change).isVisible(args.db.get());
}
/** Find all users who are authors of any part of this change. */