ReviewerAddedEvent: extend event with 'adder'

Several other events (ReviewerDeletedEvent, CommentAddedEvent, etc.) contain
the event originator but this information is missing for ReviewerAddedEvent.

Change-Id: I6112b898eb7d5a1d06bee5d21eaa1d66d5ff9cc9
Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
This commit is contained in:
Jacek Centkowski 2019-11-10 06:38:02 +01:00 committed by David Pursehouse
parent 942a39cd53
commit 1d0df4d481
3 changed files with 4 additions and 0 deletions

View File

@ -234,6 +234,8 @@ patchSet:: link:json.html#patchSet[patchSet attribute]
reviewer:: link:json.html#account[account attribute]
adder:: user that added the reviewer as link:json.html#account[account attribute]
eventCreatedOn:: Time in seconds since the UNIX epoch when this event was
created.

View File

@ -21,6 +21,7 @@ import com.google.gerrit.server.data.AccountAttribute;
public class ReviewerAddedEvent extends PatchSetEvent {
static final String TYPE = "reviewer-added";
public Supplier<AccountAttribute> reviewer;
public Supplier<AccountAttribute> adder;
public ReviewerAddedEvent(Change change) {
super(TYPE, change);

View File

@ -317,6 +317,7 @@ public class StreamEventsApiListener
event.change = changeAttributeSupplier(change, notes);
event.patchSet = patchSetAttributeSupplier(change, psUtil.current(notes));
event.adder = accountAttributeSupplier(ev.getWho());
for (AccountInfo reviewer : ev.getReviewers()) {
event.reviewer = accountAttributeSupplier(reviewer);
dispatcher.run(d -> d.postEvent(event));