Cut off ",edit" suffix before parsing change id

In change edit workflow, ",edit" suffix was added to differentiate
between edit and review contexts, e.g. to pre-activate edit mode.
Parsing of change id wasn't adjusted to respect this suffix. As the
consequence javascript exception happens, during attempt to parse
"change-number,edit" as change id.

Bug: issue 3079
Change-Id: Ia9b418153a9c165cad15a1791627d5a22620191b
This commit is contained in:
David Ostrovsky 2014-12-23 16:59:28 +01:00 committed by David Ostrovsky
parent 68038a3591
commit cc44a0b486

View File

@ -521,7 +521,12 @@ public class ChangeScreen2 extends Screen {
private void scrollToPath(String token) {
int s = token.indexOf('/');
try {
if (s < 0 || !changeId.equals(Change.Id.parse(token.substring(0, s)))) {
String c = token.substring(0, s);
int editIndex = c.indexOf(",edit");
if (editIndex > 0) {
c = c.substring(0, editIndex);
}
if (s < 0 || !changeId.equals(Change.Id.parse(c))) {
return; // Unrelated URL, do not scroll.
}
} catch (IllegalArgumentException e) {