Move ChangeKind to PatchSetAttribute
When adding the ChangeKind for JSON data, I added it into PatchSetCreatedEvent which ended up being a pretty lousy place to add it, since it has little to do with the event, and more to do with the PatchSetAttribute itself. This moves the data to the PatchSet JSON structure, alongside the draft attribute. Change-Id: Ia3791789af2ddb6efc70d78f38595519b5d6ab5f
This commit is contained in:
@@ -30,7 +30,6 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.AccountCache;
|
||||
import com.google.gerrit.server.account.AccountState;
|
||||
import com.google.gerrit.server.change.ChangeKindCache;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.config.SitePaths;
|
||||
@@ -210,8 +209,6 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
|
||||
|
||||
private final AccountCache accountCache;
|
||||
|
||||
private final ChangeKindCache changeKindCache;
|
||||
|
||||
private final EventFactory eventFactory;
|
||||
|
||||
private final SitePaths sitePaths;
|
||||
@@ -239,7 +236,6 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
|
||||
final SitePaths sitePath,
|
||||
final ProjectCache projectCache,
|
||||
final AccountCache accountCache,
|
||||
final ChangeKindCache changeKindCache,
|
||||
final EventFactory eventFactory,
|
||||
final SitePaths sitePaths,
|
||||
final DynamicSet<ChangeListener> unrestrictedListeners) {
|
||||
@@ -248,7 +244,6 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
|
||||
this.hookQueue = queue.createQueue(1, "hook");
|
||||
this.projectCache = projectCache;
|
||||
this.accountCache = accountCache;
|
||||
this.changeKindCache = changeKindCache;
|
||||
this.eventFactory = eventFactory;
|
||||
this.sitePaths = sitePath;
|
||||
this.unrestrictedListeners = unrestrictedListeners;
|
||||
@@ -359,13 +354,12 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
|
||||
event.change = eventFactory.asChangeAttribute(change);
|
||||
event.patchSet = eventFactory.asPatchSetAttribute(patchSet);
|
||||
event.uploader = eventFactory.asAccountAttribute(uploader.getAccount());
|
||||
event.kind = changeKindCache.getChangeKind(db, change, patchSet);
|
||||
fireEvent(change, event, db);
|
||||
|
||||
final List<String> args = new ArrayList<>();
|
||||
addArg(args, "--change", event.change.id);
|
||||
addArg(args, "--is-draft", String.valueOf(patchSet.isDraft()));
|
||||
addArg(args, "--kind", String.valueOf(event.kind));
|
||||
addArg(args, "--kind", String.valueOf(event.patchSet.kind));
|
||||
addArg(args, "--change-url", event.change.url);
|
||||
addArg(args, "--change-owner", getDisplayName(owner.getAccount()));
|
||||
addArg(args, "--project", event.change.project);
|
||||
|
||||
Reference in New Issue
Block a user