From 1d0df4d4819d8480c97c91b5d7bed7b8920949c7 Mon Sep 17 00:00:00 2001 From: Jacek Centkowski Date: Sun, 10 Nov 2019 06:38:02 +0100 Subject: [PATCH] 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 --- Documentation/cmd-stream-events.txt | 2 ++ java/com/google/gerrit/server/events/ReviewerAddedEvent.java | 1 + .../google/gerrit/server/events/StreamEventsApiListener.java | 1 + 3 files changed, 4 insertions(+) diff --git a/Documentation/cmd-stream-events.txt b/Documentation/cmd-stream-events.txt index e8c5213e8f..f0ad460380 100644 --- a/Documentation/cmd-stream-events.txt +++ b/Documentation/cmd-stream-events.txt @@ -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. diff --git a/java/com/google/gerrit/server/events/ReviewerAddedEvent.java b/java/com/google/gerrit/server/events/ReviewerAddedEvent.java index 9644456d4f..ea6bda3e74 100644 --- a/java/com/google/gerrit/server/events/ReviewerAddedEvent.java +++ b/java/com/google/gerrit/server/events/ReviewerAddedEvent.java @@ -21,6 +21,7 @@ import com.google.gerrit.server.data.AccountAttribute; public class ReviewerAddedEvent extends PatchSetEvent { static final String TYPE = "reviewer-added"; public Supplier reviewer; + public Supplier adder; public ReviewerAddedEvent(Change change) { super(TYPE, change); diff --git a/java/com/google/gerrit/server/events/StreamEventsApiListener.java b/java/com/google/gerrit/server/events/StreamEventsApiListener.java index 3add4cac13..5b2c368ae8 100644 --- a/java/com/google/gerrit/server/events/StreamEventsApiListener.java +++ b/java/com/google/gerrit/server/events/StreamEventsApiListener.java @@ -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));