Copy labels dynamically in ApprovalsUtil.byPatchSet
The intent is to use this method from ChangeJson to dynamically copy labels every time the change detail is loaded, thus not relying on one-time copying of labels in the notedb read path. To do so requires a bit of refactoring, since the ChangeControl now needs to be passed into this method. Change-Id: I8bc25d32a91218e074517dcacf4bf3a77d4ae957
This commit is contained in:
@@ -343,12 +343,15 @@ public class ChangeData {
|
||||
return changeControl != null;
|
||||
}
|
||||
|
||||
public ChangeControl changeControl() throws NoSuchChangeException,
|
||||
OrmException {
|
||||
public ChangeControl changeControl() throws OrmException {
|
||||
if (changeControl == null) {
|
||||
Change c = change();
|
||||
changeControl =
|
||||
changeControlFactory.controlFor(c, userFactory.create(c.getOwner()));
|
||||
try {
|
||||
changeControl =
|
||||
changeControlFactory.controlFor(c, userFactory.create(c.getOwner()));
|
||||
} catch (NoSuchChangeException e) {
|
||||
throw new OrmException(e);
|
||||
}
|
||||
}
|
||||
return changeControl;
|
||||
}
|
||||
@@ -397,8 +400,8 @@ public class ChangeData {
|
||||
} else if (allApprovals != null) {
|
||||
return allApprovals.get(c.currentPatchSetId());
|
||||
} else {
|
||||
currentApprovals = approvalsUtil.byPatchSet(
|
||||
db, notes(), c.currentPatchSetId());
|
||||
currentApprovals = ImmutableList.copyOf(approvalsUtil.byPatchSet(
|
||||
db, changeControl(), c.currentPatchSetId()));
|
||||
}
|
||||
}
|
||||
return currentApprovals;
|
||||
|
||||
Reference in New Issue
Block a user