Added the emailReviewers as a global capability

This adds functionality to deny the emailing of reviewers to certain
groups.  This will replace the emailOnlyAuthors flag on the
AccountGroup.

Change-Id: If3697e88df50e0b0256b5b6a1ea810343124b96f
This commit is contained in:
Colby Ranger
2012-04-10 13:41:19 -07:00
parent 7a9bb6adc8
commit d9488f0c37
5 changed files with 62 additions and 16 deletions

View File

@@ -70,12 +70,17 @@ public abstract class ChangeEmail extends OutgoingEmail {
/** Is the from user in an email squelching group? */
final IdentifiedUser user = args.identifiedUserFactory.create(id);
final Set<AccountGroup.UUID> gids = user.getEffectiveGroups().getKnownGroups();
for (final AccountGroup.UUID gid : gids) {
AccountGroup group = args.groupCache.get(gid);
if (group != null && group.isEmailOnlyAuthors()) {
emailOnlyAuthors = true;
break;
if (!user.getCapabilities().canEmailReviewers()) {
emailOnlyAuthors = true;
} else {
// TODO(cranger): remove once the schema is migrated in the next patch.
final Set<AccountGroup.UUID> gids = user.getEffectiveGroups().getKnownGroups();
for (final AccountGroup.UUID gid : gids) {
AccountGroup group = args.groupCache.get(gid);
if (group != null && group.isEmailOnlyAuthors()) {
emailOnlyAuthors = true;
break;
}
}
}
}