Consider change ETag computations from plugins when computing ETag for actions
Change I358e3d4fb added an extension point that allows plugins to contribute to the ETag computation of changes. One case where plugins need to contribute to the ETag computation is if they implement a SubmitRule which is based on plugin data, because only then it is guaranteed that callers always see current submittable information in ChangeInfo. In the case where a plugin implements a SubmitRule it is also important to include the change ETag computations from plugins when the ETag for revision actions is computed because the revision actions decide whether the 'Submit' button should be shown. If change ETag computations from plugins are not considered when the ETag for the revision actions is computed it can happen that the submittable information in ChangeInfo disagrees with the presence/absense of the 'Submit' button. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Id83533e7b67cc82737feb6615c8ec9277b676d1b
This commit is contained in:
@@ -197,6 +197,14 @@ public class ChangeResource implements RestResource, HasETag {
|
||||
for (ProjectState p : projectStateTree) {
|
||||
hashObjectId(h, p.getConfig().getRevision(), buf);
|
||||
}
|
||||
|
||||
changeETagComputation.runEach(
|
||||
c -> {
|
||||
String pluginETag = c.getETag(notes.getProjectName(), notes.getChangeId());
|
||||
if (pluginETag != null) {
|
||||
h.putString(pluginETag, UTF_8);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,13 +214,6 @@ public class ChangeResource implements RestResource, HasETag {
|
||||
h.putString(starredChangesUtil.getObjectId(user.getAccountId(), getId()).name(), UTF_8);
|
||||
}
|
||||
prepareETag(h, user);
|
||||
changeETagComputation.runEach(
|
||||
c -> {
|
||||
String pluginETag = c.getETag(notes.getProjectName(), notes.getChangeId());
|
||||
if (pluginETag != null) {
|
||||
h.putString(pluginETag, UTF_8);
|
||||
}
|
||||
});
|
||||
return h.hash().toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user