New event listeners and new event types
This is a first step towards moving ChangeHooks into a plugin. The listeners[1] are now invoked from all places where corresponding hooks are invoked. Invocation of hooks is not removed in this change. This will happen when we make sure that they are invoked from a new event listener. [1] All listeners under: gerrit-extension-api/src/main/java/com/google/gerrit/extensions/events/ Change-Id: I6e5356edb2c326d2d7a0133b84509ad6071140d0
This commit is contained in:
committed by
David Pursehouse
parent
32c126204b
commit
59cdd227a9
@@ -29,6 +29,7 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||
import com.google.gerrit.server.ChangeUtil;
|
||||
import com.google.gerrit.server.change.PutTopic.Input;
|
||||
import com.google.gerrit.server.extensions.events.TopicEdited;
|
||||
import com.google.gerrit.server.git.BatchUpdate;
|
||||
import com.google.gerrit.server.git.BatchUpdate.ChangeContext;
|
||||
import com.google.gerrit.server.git.BatchUpdate.Context;
|
||||
@@ -47,6 +48,7 @@ public class PutTopic implements RestModifyView<ChangeResource, Input>,
|
||||
private final ChangeHooks hooks;
|
||||
private final ChangeMessagesUtil cmUtil;
|
||||
private final BatchUpdate.Factory batchUpdateFactory;
|
||||
private final TopicEdited topicEdited;
|
||||
|
||||
public static class Input {
|
||||
@DefaultInput
|
||||
@@ -57,11 +59,13 @@ public class PutTopic implements RestModifyView<ChangeResource, Input>,
|
||||
PutTopic(Provider<ReviewDb> dbProvider,
|
||||
ChangeHooks hooks,
|
||||
ChangeMessagesUtil cmUtil,
|
||||
BatchUpdate.Factory batchUpdateFactory) {
|
||||
BatchUpdate.Factory batchUpdateFactory,
|
||||
TopicEdited topicEdited) {
|
||||
this.dbProvider = dbProvider;
|
||||
this.hooks = hooks;
|
||||
this.cmUtil = cmUtil;
|
||||
this.batchUpdateFactory = batchUpdateFactory;
|
||||
this.topicEdited = topicEdited;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,6 +133,9 @@ public class PutTopic implements RestModifyView<ChangeResource, Input>,
|
||||
@Override
|
||||
public void postUpdate(Context ctx) throws OrmException {
|
||||
if (change != null) {
|
||||
topicEdited.fire(change,
|
||||
ctx.getUser().asIdentifiedUser().getAccount(),
|
||||
oldTopicName);
|
||||
hooks.doTopicChangedHook(
|
||||
change,
|
||||
ctx.getUser().asIdentifiedUser().getAccount(),
|
||||
|
||||
Reference in New Issue
Block a user