ReviewerDeletedEvent: Include user that removed the reviewer

When a reviewer is removed from the change, the emitted stream event
does not include information about who removed the reviewer.

The documentation mentions an "author" field, but there is no such
field included in the output.

Add a "remover" field to the event and correct the documentation.

Change-Id: I72b3ecb10fc568914aa7ceb4afe35f6e3584a976
This commit is contained in:
David Pursehouse 2017-07-20 10:39:32 +09:00
parent 94b76cf24c
commit bb6d8832d4
3 changed files with 4 additions and 2 deletions

View File

@ -255,9 +255,9 @@ change:: link:json.html#change[change attribute]
patchSet:: link:json.html#patchSet[patchSet attribute]
reviewer:: link:json.html#account[account attribute]
reviewer:: reviewer that was removed as link:json.html#account[account attribute]
author:: link:json.html#account[account attribute]
remover:: user that removed the reviewer as link:json.html#account[account attribute]
approvals:: All link:json.html#approval[approval attributes] removed.

View File

@ -22,6 +22,7 @@ import com.google.gerrit.server.data.ApprovalAttribute;
public class ReviewerDeletedEvent extends PatchSetEvent {
public static final String TYPE = "reviewer-deleted";
public Supplier<AccountAttribute> reviewer;
public Supplier<AccountAttribute> remover;
public Supplier<ApprovalAttribute[]> approvals;
public String comment;

View File

@ -309,6 +309,7 @@ public class StreamEventsApiListener
event.change = changeAttributeSupplier(change);
event.patchSet = patchSetAttributeSupplier(change, psUtil.current(db.get(), notes));
event.reviewer = accountAttributeSupplier(ev.getReviewer());
event.remover = accountAttributeSupplier(ev.getWho());
event.comment = ev.getComment();
event.approvals =
approvalsAttributeSupplier(change, ev.getNewApprovals(), ev.getOldApprovals());