ReceiveCommits: Fire add comment hook when approvals provided
I52a6799395 extended magic branch options with approvals. It was pointed out: [1] that add comment hook should also be fired in this case. [1] https://groups.google.com/d/topic/repo-discuss/Fr7Yuqqno2M/discussion Reported-By: Björn Pedersen <iceelch@googlemail.com> Change-Id: Ib8ae9f2537033423365b532bb3669d03cb1f63f6
This commit is contained in:
committed by
David Pursehouse
parent
44a935eb0a
commit
3eeb74f8f3
@@ -31,6 +31,7 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.ApprovalsUtil;
|
||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||
import com.google.gerrit.server.ChangeUtil;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.AccountCache;
|
||||
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
|
||||
import com.google.gerrit.server.git.WorkQueue;
|
||||
@@ -278,6 +279,12 @@ public class ChangeInserter {
|
||||
accountCache.get(change.getOwner()).getAccount(),
|
||||
hashtags, null, hashtags, db);
|
||||
}
|
||||
|
||||
if (approvals != null && !approvals.isEmpty()) {
|
||||
hooks.doCommentAddedHook(change,
|
||||
((IdentifiedUser) ctl.getCurrentUser()).getAccount(), patchSet,
|
||||
null, approvals, db);
|
||||
}
|
||||
}
|
||||
|
||||
return change;
|
||||
|
||||
@@ -2306,6 +2306,11 @@ public class ReceiveCommits {
|
||||
change, currentUser.getAccount(), newPatchSet, db, newCommit.getName());
|
||||
}
|
||||
|
||||
if (!approvals.isEmpty()) {
|
||||
hooks.doCommentAddedHook(change, currentUser.getAccount(), newPatchSet,
|
||||
null, approvals, db);
|
||||
}
|
||||
|
||||
if (magicBranch != null && magicBranch.submit) {
|
||||
submit(changeCtl, newPatchSet);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user