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:
@@ -35,6 +35,7 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.ApprovalsUtil;
|
||||
import com.google.gerrit.server.GerritPersonIdent;
|
||||
import com.google.gerrit.server.account.AccountCache;
|
||||
import com.google.gerrit.server.change.ChangeKindCache;
|
||||
import com.google.gerrit.server.config.CanonicalWebUrl;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ApprovalAttribute;
|
||||
@@ -84,6 +85,7 @@ public class EventFactory {
|
||||
private final Provider<ReviewDb> db;
|
||||
private final ChangeData.Factory changeDataFactory;
|
||||
private final ApprovalsUtil approvalsUtil;
|
||||
private final ChangeKindCache changeKindCache;
|
||||
|
||||
@Inject
|
||||
EventFactory(AccountCache accountCache,
|
||||
@@ -93,7 +95,8 @@ public class EventFactory {
|
||||
@GerritPersonIdent PersonIdent myIdent,
|
||||
Provider<ReviewDb> db,
|
||||
ChangeData.Factory changeDataFactory,
|
||||
ApprovalsUtil approvalsUtil) {
|
||||
ApprovalsUtil approvalsUtil,
|
||||
ChangeKindCache changeKindCache) {
|
||||
this.accountCache = accountCache;
|
||||
this.urlProvider = urlProvider;
|
||||
this.patchListCache = patchListCache;
|
||||
@@ -103,6 +106,7 @@ public class EventFactory {
|
||||
this.db = db;
|
||||
this.changeDataFactory = changeDataFactory;
|
||||
this.approvalsUtil = approvalsUtil;
|
||||
this.changeKindCache = changeKindCache;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,6 +430,7 @@ public class EventFactory {
|
||||
p.sizeInsertions += pe.getInsertions();
|
||||
}
|
||||
}
|
||||
p.kind = changeKindCache.getChangeKind(db, change, patchSet);
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import com.google.gerrit.server.change.ChangeKind;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
@@ -24,5 +23,4 @@ public class PatchSetCreatedEvent extends ChangeEvent {
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute uploader;
|
||||
public ChangeKind kind;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user