Merge branch 'stable-2.11' into stable-2.12
* stable-2.11: Set version to 2.11.7 Release notes for Gerrit 2.11.7 Document new allowrcpt restriction on adding user email OutputStreamQuery: fix comments with current-patch-set option Add tests for ssh query command EmailReviewComments: Provide the current user instead of exception OutputStreamQuery: Take files into account when adding patch sets Update 2.11.6 release notes Change-Id: I6b24624da6af024e340a672b2ac527d5510f5219
This commit is contained in:
@@ -17,13 +17,13 @@ package com.google.gerrit.server.change;
|
||||
import static com.google.gerrit.server.PatchLineCommentsUtil.PLC_ORDER;
|
||||
|
||||
import com.google.gerrit.extensions.api.changes.ReviewInput.NotifyHandling;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.git.SendEmailExecutor;
|
||||
import com.google.gerrit.server.mail.CommentSender;
|
||||
import com.google.gerrit.server.patch.PatchSetInfoFactory;
|
||||
@@ -32,7 +32,6 @@ import com.google.gerrit.server.util.ThreadLocalRequestContext;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.gwtorm.server.SchemaFactory;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.OutOfScopeException;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.ProvisionException;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
@@ -51,7 +50,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
|
||||
NotifyHandling notify,
|
||||
Change change,
|
||||
PatchSet patchSet,
|
||||
Account.Id authorId,
|
||||
IdentifiedUser user,
|
||||
ChangeMessage message,
|
||||
List<PatchLineComment> comments);
|
||||
}
|
||||
@@ -65,13 +64,13 @@ public class EmailReviewComments implements Runnable, RequestContext {
|
||||
private final NotifyHandling notify;
|
||||
private final Change change;
|
||||
private final PatchSet patchSet;
|
||||
private final Account.Id authorId;
|
||||
private final IdentifiedUser user;
|
||||
private final ChangeMessage message;
|
||||
private List<PatchLineComment> comments;
|
||||
private ReviewDb db;
|
||||
|
||||
@Inject
|
||||
EmailReviewComments (
|
||||
EmailReviewComments(
|
||||
@SendEmailExecutor ExecutorService executor,
|
||||
PatchSetInfoFactory patchSetInfoFactory,
|
||||
CommentSender.Factory commentSenderFactory,
|
||||
@@ -80,7 +79,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
|
||||
@Assisted NotifyHandling notify,
|
||||
@Assisted Change change,
|
||||
@Assisted PatchSet patchSet,
|
||||
@Assisted Account.Id authorId,
|
||||
@Assisted IdentifiedUser user,
|
||||
@Assisted ChangeMessage message,
|
||||
@Assisted List<PatchLineComment> comments) {
|
||||
this.sendEmailsExecutor = executor;
|
||||
@@ -91,7 +90,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
|
||||
this.notify = notify;
|
||||
this.change = change;
|
||||
this.patchSet = patchSet;
|
||||
this.authorId = authorId;
|
||||
this.user = user;
|
||||
this.message = message;
|
||||
this.comments = PLC_ORDER.sortedCopy(comments);
|
||||
}
|
||||
@@ -106,7 +105,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
|
||||
try {
|
||||
|
||||
CommentSender cm = commentSenderFactory.create(notify, change.getId());
|
||||
cm.setFrom(authorId);
|
||||
cm.setFrom(user.getAccountId());
|
||||
cm.setPatchSet(patchSet, patchSetInfoFactory.get(change, patchSet));
|
||||
cm.setChangeMessage(message);
|
||||
cm.setPatchLineComments(comments);
|
||||
@@ -129,7 +128,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
|
||||
|
||||
@Override
|
||||
public CurrentUser getUser() {
|
||||
throw new OutOfScopeException("No user on email thread");
|
||||
return user.getRealUser();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -376,7 +376,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
||||
in.notify,
|
||||
change,
|
||||
ps,
|
||||
user.getAccountId(),
|
||||
user,
|
||||
message,
|
||||
comments).sendAsync();
|
||||
}
|
||||
|
||||
@@ -293,6 +293,10 @@ public class OutputStreamQuery {
|
||||
eventFactory.addPatchSetFileNames(c.currentPatchSet,
|
||||
d.change(), d.currentPatchSet());
|
||||
}
|
||||
if (includeComments) {
|
||||
eventFactory.addPatchSetComments(c.currentPatchSet,
|
||||
d.publishedComments());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +305,7 @@ public class OutputStreamQuery {
|
||||
if (includePatchSets) {
|
||||
eventFactory.addPatchSets(db.get(), rw, c, d.patchSets(),
|
||||
includeApprovals ? d.approvals().asMap() : null,
|
||||
labelTypes);
|
||||
includeFiles, d.change(), labelTypes);
|
||||
for (PatchSetAttribute attribute : c.patchSets) {
|
||||
eventFactory.addPatchSetComments(
|
||||
attribute, d.publishedComments());
|
||||
|
||||
Reference in New Issue
Block a user