Fix _selectedRevision for edit patchset

Change-Id: I1b415cea3e58e9d514e7c21e4982bf100f48cf1e
This commit is contained in:
Tao Zhou 2020-02-24 15:07:07 +01:00
parent 204a9beb25
commit d463e226bc

View File

@ -1442,8 +1442,14 @@
} else {
this._selectedRevision =
Object.values(this._change.revisions).find(
revision => revision._number ===
parseInt(this._patchRange.patchNum, 10));
revision => {
// edit patchset is a special one
const thePatchNum = this._patchRange.patchNum;
if (thePatchNum === 'edit') {
return revision._number === thePatchNum;
}
return revision._number === parseInt(thePatchNum, 10);
});
}
});
}
@ -1935,8 +1941,12 @@
if (!this._selectedRevision) {
return;
}
// If patchNumStr is"edit", then patchNum is undefined hence an OR
const patchNum = parseInt(patchNumStr, 10) || patchNumStr;
let patchNum = parseInt(patchNumStr, 10);
if (patchNumStr === 'edit') {
patchNum = patchNumStr;
}
if (patchNum === this._selectedRevision._number) {
return;
}