ETag computation needs to honor changes in other changes
If `submitWholetopic` is enabled a change may stay unchanged, but a change in the same topic can influence submittability. Change-Id: I5c958369e9deec9546bc691629f14266d6755721
This commit is contained in:
@@ -57,17 +57,15 @@ public class ChangeResource implements RestResource, HasETag {
|
||||
return getControl().getNotes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getETag() {
|
||||
CurrentUser user = control.getCurrentUser();
|
||||
Hasher h = Hashing.md5().newHasher()
|
||||
.putLong(getChange().getLastUpdatedOn().getTime())
|
||||
|
||||
// This includes all information relevant for ETag computation
|
||||
// unrelated to the UI.
|
||||
public void prepareETag(Hasher h, CurrentUser user) {
|
||||
h.putLong(getChange().getLastUpdatedOn().getTime())
|
||||
.putInt(getChange().getRowVersion())
|
||||
.putBoolean(user.getStarredChanges().contains(getChange().getId()))
|
||||
.putInt(user.isIdentifiedUser()
|
||||
? ((IdentifiedUser) user).getAccountId().get()
|
||||
: 0);
|
||||
|
||||
byte[] buf = new byte[20];
|
||||
ObjectId noteId;
|
||||
try {
|
||||
@@ -82,6 +80,14 @@ public class ChangeResource implements RestResource, HasETag {
|
||||
for (ProjectState p : control.getProjectControl().getProjectState().tree()) {
|
||||
hashObjectId(h, p.getConfig().getRevision(), buf);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getETag() {
|
||||
CurrentUser user = control.getCurrentUser();
|
||||
Hasher h = Hashing.md5().newHasher()
|
||||
.putBoolean(user.getStarredChanges().contains(getChange().getId()));
|
||||
prepareETag(h, user);
|
||||
return h.hash().toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user