Opt-in to ChangeScreen2 as a per-tab preference

If the user visits ChangeScreen2 using #c2/... within this application
session always redirect all #c/... links to ChangeScreen2. This makes
for a smoother flow from search results and the dashboard into the new
UI. Users can get rid of the new UI by simply opening a new tab or a
reload in the current one without #c2/ in the URL.

Change-Id: Ie4890e2d564fa2b896e9dbf52e38f43804d9e470
This commit is contained in:
Shawn Pearce
2013-07-14 19:51:23 -07:00
parent 097b957915
commit c5e1654bb6
4 changed files with 11 additions and 15 deletions

View File

@@ -92,6 +92,8 @@ import com.google.gwt.user.client.Window;
import com.google.gwtorm.client.KeyUtil;
public class Dispatcher {
private static boolean useChangeScreen2;
public static String toPatchSideBySide(final Patch.Key id) {
return toPatch("", null, id);
}
@@ -467,8 +469,8 @@ public class Dispatcher {
}
if (rest.isEmpty()) {
Gerrit.display(token, panel== null //
? new ChangeScreen(id) //
Gerrit.display(token, panel== null
? (useChangeScreen2 ? new ChangeScreen2(id, null) : new ChangeScreen(id))
: new NotFoundScreen());
return;
}
@@ -499,7 +501,9 @@ public class Dispatcher {
patch(token, base, p, 0, null, null, panel);
} else {
if (panel == null) {
Gerrit.display(token, new ChangeScreen(ps));
Gerrit.display(token, useChangeScreen2
? new ChangeScreen2(id, String.valueOf(ps.get()))
: new ChangeScreen(id));
} else if ("publish".equals(panel)) {
publish(ps);
} else {
@@ -519,6 +523,7 @@ public class Dispatcher {
id = Change.Id.parse(rest);
rest = "";
}
useChangeScreen2 = true;
Gerrit.display(token, new ChangeScreen2(id, rest));
}