Merge "Fix _selectedRevision for edit patchset"

This commit is contained in:
Tao Zhou 2020-02-26 11:28:30 +00:00 committed by Gerrit Code Review
commit 83c280c204

View File

@ -1470,8 +1470,14 @@
} else { } else {
this._selectedRevision = this._selectedRevision =
Object.values(this._change.revisions).find( Object.values(this._change.revisions).find(
revision => revision._number === revision => {
parseInt(this._patchRange.patchNum, 10)); // edit patchset is a special one
const thePatchNum = this._patchRange.patchNum;
if (thePatchNum === 'edit') {
return revision._number === thePatchNum;
}
return revision._number === parseInt(thePatchNum, 10);
});
} }
}); });
} }
@ -1963,8 +1969,12 @@
if (!this._selectedRevision) { if (!this._selectedRevision) {
return; 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) { if (patchNum === this._selectedRevision._number) {
return; return;
} }