EmailMerge: provide user when available
Change-Id: I083bcf371444544a6c98a36d74a1f1361863b787
This commit is contained in:
parent
a772a0abc2
commit
a3f22a26ef
@ -19,6 +19,7 @@ import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.mail.MergedSender;
|
||||
import com.google.gerrit.server.util.RequestContext;
|
||||
import com.google.gerrit.server.util.ThreadLocalRequestContext;
|
||||
@ -46,6 +47,7 @@ public class EmailMerge implements Runnable, RequestContext {
|
||||
private final MergedSender.Factory mergedSenderFactory;
|
||||
private final SchemaFactory<ReviewDb> schemaFactory;
|
||||
private final ThreadLocalRequestContext requestContext;
|
||||
private final IdentifiedUser.GenericFactory identifiedUserFactory;
|
||||
|
||||
private final Change.Id changeId;
|
||||
private final Account.Id submitter;
|
||||
@ -56,12 +58,14 @@ public class EmailMerge implements Runnable, RequestContext {
|
||||
MergedSender.Factory mergedSenderFactory,
|
||||
SchemaFactory<ReviewDb> schemaFactory,
|
||||
ThreadLocalRequestContext requestContext,
|
||||
IdentifiedUser.GenericFactory identifiedUserFactory,
|
||||
@Assisted Change.Id changeId,
|
||||
@Assisted @Nullable Account.Id submitter) {
|
||||
this.sendEmailsExecutor = executor;
|
||||
this.mergedSenderFactory = mergedSenderFactory;
|
||||
this.schemaFactory = schemaFactory;
|
||||
this.requestContext = requestContext;
|
||||
this.identifiedUserFactory = identifiedUserFactory;
|
||||
this.changeId = changeId;
|
||||
this.submitter = submitter;
|
||||
}
|
||||
@ -97,6 +101,10 @@ public class EmailMerge implements Runnable, RequestContext {
|
||||
|
||||
@Override
|
||||
public CurrentUser getUser() {
|
||||
if (submitter != null) {
|
||||
return identifiedUserFactory.create(
|
||||
getReviewDbProvider(), submitter).getRealUser();
|
||||
}
|
||||
throw new OutOfScopeException("No user on email thread");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user