Move @AnonymousCowardName into EmailArguments
Change-Id: I8575ca45655bcd4496c88e0bd87530b44c66992a
This commit is contained in:
committed by
Edwin Kempin
parent
7609714b2c
commit
386add71e3
@@ -15,9 +15,8 @@
|
||||
package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
@@ -29,9 +28,8 @@ public class AbandonedSender extends ReplyToChangeSender {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public AbandonedSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c, "abandon");
|
||||
public AbandonedSender(EmailArguments ea, @Assisted Change c) {
|
||||
super(ea, c, "abandon");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,6 @@ package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.ssh.SshInfo;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
@@ -28,10 +27,8 @@ public class AddReviewerSender extends NewChangeSender {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public AddReviewerSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, SshInfo si,
|
||||
@Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c);
|
||||
public AddReviewerSender(EmailArguments ea, SshInfo si, @Assisted Change c) {
|
||||
super(ea, c);
|
||||
setSshInfo(si);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,9 +65,8 @@ public abstract class ChangeEmail extends NotificationEmail {
|
||||
protected Set<Account.Id> authors;
|
||||
protected boolean emailOnlyAuthors;
|
||||
|
||||
protected ChangeEmail(EmailArguments ea, final String anonymousCowardName,
|
||||
final Change c, final String mc) {
|
||||
super(ea, anonymousCowardName, mc, c.getProject(), c.getDest());
|
||||
protected ChangeEmail(EmailArguments ea, Change c, String mc) {
|
||||
super(ea, mc, c.getProject(), c.getDest());
|
||||
change = c;
|
||||
changeData = new ChangeData(change);
|
||||
emailOnlyAuthors = false;
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Patch;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.server.change.PostReview.NotifyHandling;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.patch.PatchFile;
|
||||
import com.google.gerrit.server.patch.PatchList;
|
||||
import com.google.gerrit.server.patch.PatchListNotAvailableException;
|
||||
@@ -47,10 +46,9 @@ public class CommentSender extends ReplyToChangeSender {
|
||||
|
||||
@Inject
|
||||
public CommentSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName,
|
||||
@Assisted NotifyHandling notify,
|
||||
@Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c, "comment");
|
||||
super(ea, c, "comment");
|
||||
this.notify = notify;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.ssh.SshInfo;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
@@ -27,10 +26,9 @@ public class CommitMessageEditedSender extends ReplacePatchSetSender {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public CommitMessageEditedSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, SshInfo si,
|
||||
public CommitMessageEditedSender(EmailArguments ea, SshInfo si,
|
||||
@Assisted Change c) {
|
||||
super(ea, anonymousCowardName, si, c);
|
||||
super(ea, si, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.mail.ProjectWatch.Watchers;
|
||||
import com.google.gerrit.server.ssh.SshInfo;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
@@ -39,10 +38,8 @@ public class CreateChangeSender extends NewChangeSender {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public CreateChangeSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, SshInfo si,
|
||||
@Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c);
|
||||
public CreateChangeSender(EmailArguments ea, SshInfo si, @Assisted Change c) {
|
||||
super(ea, c);
|
||||
setSshInfo(si);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.google.gerrit.server.account.CapabilityControl;
|
||||
import com.google.gerrit.server.account.GroupBackend;
|
||||
import com.google.gerrit.server.account.GroupIncludeCache;
|
||||
import com.google.gerrit.server.config.AllProjectsName;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.config.CanonicalWebUrl;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.patch.PatchListCache;
|
||||
@@ -50,6 +51,7 @@ class EmailArguments {
|
||||
final IdentifiedUser.GenericFactory identifiedUserFactory;
|
||||
final CapabilityControl.Factory capabilityControlFactory;
|
||||
final AnonymousUser anonymousUser;
|
||||
final String anonymousCowardName;
|
||||
final Provider<String> urlProvider;
|
||||
final AllProjectsName allProjectsName;
|
||||
|
||||
@@ -68,6 +70,7 @@ class EmailArguments {
|
||||
GenericFactory identifiedUserFactory,
|
||||
CapabilityControl.Factory capabilityControlFactory,
|
||||
AnonymousUser anonymousUser,
|
||||
@AnonymousCowardName String anonymousCowardName,
|
||||
@CanonicalWebUrl @Nullable Provider<String> urlProvider,
|
||||
AllProjectsName allProjectsName,
|
||||
ChangeQueryBuilder.Factory queryBuilder,
|
||||
@@ -86,6 +89,7 @@ class EmailArguments {
|
||||
this.identifiedUserFactory = identifiedUserFactory;
|
||||
this.capabilityControlFactory = capabilityControlFactory;
|
||||
this.anonymousUser = anonymousUser;
|
||||
this.anonymousCowardName = anonymousCowardName;
|
||||
this.urlProvider = urlProvider;
|
||||
this.allProjectsName = allProjectsName;
|
||||
this.queryBuilder = queryBuilder;
|
||||
|
||||
@@ -16,7 +16,6 @@ package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
@@ -27,9 +26,8 @@ public class MergeFailSender extends ReplyToChangeSender {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public MergeFailSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c, "merge-failed");
|
||||
public MergeFailSender(EmailArguments ea, @Assisted Change c) {
|
||||
super(ea, c, "merge-failed");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,12 +18,11 @@ import com.google.gerrit.common.data.ApprovalType;
|
||||
import com.google.gerrit.common.data.ApprovalTypes;
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||
import com.google.gerrit.reviewdb.client.ApprovalCategory;
|
||||
import com.google.gerrit.reviewdb.client.ApprovalCategoryValue;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
@@ -40,10 +39,8 @@ public class MergedSender extends ReplyToChangeSender {
|
||||
private final ApprovalTypes approvalTypes;
|
||||
|
||||
@Inject
|
||||
public MergedSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, ApprovalTypes at,
|
||||
@Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c, "merged");
|
||||
public MergedSender(EmailArguments ea, ApprovalTypes at, @Assisted Change c) {
|
||||
super(ea, c, "merged");
|
||||
approvalTypes = at;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,8 @@ public abstract class NewChangeSender extends ChangeEmail {
|
||||
private final Set<Account.Id> reviewers = new HashSet<Account.Id>();
|
||||
private final Set<Account.Id> extraCC = new HashSet<Account.Id>();
|
||||
|
||||
protected NewChangeSender(EmailArguments ea, String anonymousCowardName,
|
||||
Change c) {
|
||||
super(ea, anonymousCowardName, c, "newchange");
|
||||
protected NewChangeSender(EmailArguments ea, Change c) {
|
||||
super(ea, c, "newchange");
|
||||
}
|
||||
|
||||
public void addReviewers(final Collection<Account.Id> cc) {
|
||||
|
||||
@@ -41,9 +41,9 @@ public abstract class NotificationEmail extends OutgoingEmail {
|
||||
protected Branch.NameKey branch;
|
||||
private SshInfo sshInfo;
|
||||
|
||||
protected NotificationEmail(EmailArguments ea, String anonymousCowardName,
|
||||
protected NotificationEmail(EmailArguments ea,
|
||||
String mc, Project.NameKey project, Branch.NameKey branch) {
|
||||
super(ea, anonymousCowardName, mc);
|
||||
super(ea, mc);
|
||||
|
||||
this.project = project;
|
||||
this.branch = branch;
|
||||
|
||||
@@ -60,14 +60,11 @@ public abstract class OutgoingEmail {
|
||||
protected VelocityContext velocityContext;
|
||||
|
||||
protected final EmailArguments args;
|
||||
private final String anonymousCowardName;
|
||||
protected Account.Id fromId;
|
||||
|
||||
|
||||
protected OutgoingEmail(EmailArguments ea, final String anonymousCowardName,
|
||||
final String mc) {
|
||||
protected OutgoingEmail(EmailArguments ea, String mc) {
|
||||
args = ea;
|
||||
this.anonymousCowardName = anonymousCowardName;
|
||||
messageClass = mc;
|
||||
headers = new LinkedHashMap<String, EmailHeader>();
|
||||
}
|
||||
@@ -236,7 +233,7 @@ public abstract class OutgoingEmail {
|
||||
/** Lookup a human readable name for an account, usually the "full name". */
|
||||
protected String getNameFor(final Account.Id accountId) {
|
||||
if (accountId == null) {
|
||||
return anonymousCowardName;
|
||||
return args.anonymousCowardName;
|
||||
}
|
||||
|
||||
final Account userAccount = args.accountCache.get(accountId).getAccount();
|
||||
@@ -245,7 +242,7 @@ public abstract class OutgoingEmail {
|
||||
name = userAccount.getPreferredEmail();
|
||||
}
|
||||
if (name == null) {
|
||||
name = anonymousCowardName + " #" + accountId;
|
||||
name = args.anonymousCowardName + " #" + accountId;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
@@ -264,7 +261,7 @@ public abstract class OutgoingEmail {
|
||||
return email;
|
||||
|
||||
} else /* (name == null && email == null) */{
|
||||
return anonymousCowardName + " #" + accountId;
|
||||
return args.anonymousCowardName + " #" + accountId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.ssh.SshInfo;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
@@ -28,10 +27,8 @@ public class RebasedPatchSetSender extends ReplacePatchSetSender {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public RebasedPatchSetSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, SshInfo si,
|
||||
@Assisted Change c) {
|
||||
super(ea, anonymousCowardName, si, c);
|
||||
public RebasedPatchSetSender(EmailArguments ea, SshInfo si, @Assisted Change c) {
|
||||
super(ea, si, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,6 @@ package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
@@ -33,10 +32,9 @@ public class RegisterNewEmailSender extends OutgoingEmail {
|
||||
@Inject
|
||||
public RegisterNewEmailSender(EmailArguments ea,
|
||||
EmailTokenVerifier etv,
|
||||
@AnonymousCowardName String anonymousCowardName,
|
||||
IdentifiedUser callingUser,
|
||||
@Assisted final String address) {
|
||||
super(ea, anonymousCowardName, "registernewemail");
|
||||
super(ea, "registernewemail");
|
||||
tokenVerifier = etv;
|
||||
user = callingUser;
|
||||
addr = address;
|
||||
|
||||
@@ -16,9 +16,8 @@ package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.server.ssh.SshInfo;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
@@ -39,10 +38,8 @@ public class ReplacePatchSetSender extends ReplyToChangeSender {
|
||||
private final Set<Account.Id> extraCC = new HashSet<Account.Id>();
|
||||
|
||||
@Inject
|
||||
public ReplacePatchSetSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, SshInfo si,
|
||||
@Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c, "newpatchset");
|
||||
public ReplacePatchSetSender(EmailArguments ea, SshInfo si, @Assisted Change c) {
|
||||
super(ea, c, "newpatchset");
|
||||
setSshInfo(si);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,8 @@ public abstract class ReplyToChangeSender extends ChangeEmail {
|
||||
public T create(Change change);
|
||||
}
|
||||
|
||||
protected ReplyToChangeSender(EmailArguments ea, String anonymousCowardName,
|
||||
Change c, String mc) {
|
||||
super(ea, anonymousCowardName, c, mc);
|
||||
protected ReplyToChangeSender(EmailArguments ea, Change c, String mc) {
|
||||
super(ea, c, mc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
@@ -29,9 +28,8 @@ public class RestoredSender extends ReplyToChangeSender {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public RestoredSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c, "restore");
|
||||
public RestoredSender(EmailArguments ea, @Assisted Change c) {
|
||||
super(ea, c, "restore");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
@@ -28,9 +27,8 @@ public class RevertedSender extends ReplyToChangeSender {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public RevertedSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c, "revert");
|
||||
public RevertedSender(EmailArguments ea, @Assisted Change c) {
|
||||
super(ea, c, "revert");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user