Restore /c2/ URL handling
The ChangeScreen2 experiment is still fairly new. A number of links exist outside of Gerrit using /#/c2/... to view a change and enable new UI. Continue to accept /c2/ as a temporary override in the current tab. Leave a hack inside of Dispatcher for now. Once ChangeScreen2 becomes the default most of the hack can go away, but it may be necessary to continue to accept /#/c2/ as an alias for /#/c/ to prevent breaking some URLs. Change-Id: I4134869cddb1d81abf0f0f2e52d20fb25ba59bae
This commit is contained in:
@@ -94,6 +94,8 @@ import com.google.gwt.user.client.Window;
|
||||
import com.google.gwtorm.client.KeyUtil;
|
||||
|
||||
public class Dispatcher {
|
||||
public static boolean changeScreen2;
|
||||
|
||||
public static String toPatchSideBySide(final Patch.Key id) {
|
||||
return toPatch("", null, id);
|
||||
}
|
||||
@@ -223,6 +225,9 @@ public class Dispatcher {
|
||||
} else if (matchPrefix("/admin/", token)) {
|
||||
admin(token);
|
||||
|
||||
} else if (/* DEPRECATED URL */matchPrefix("/c2/", token)) {
|
||||
changeScreen2 = true;
|
||||
change(token);
|
||||
} else if (/* LEGACY URL */matchPrefix("all,", token)) {
|
||||
redirectFromLegacyToken(token, legacyAll(token));
|
||||
} else if (/* LEGACY URL */matchPrefix("mine,", token)
|
||||
@@ -521,6 +526,10 @@ public class Dispatcher {
|
||||
}
|
||||
|
||||
private static boolean isChangeScreen2() {
|
||||
if (changeScreen2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
AccountGeneralPreferences.ChangeScreen ui = null;
|
||||
if (Gerrit.isSignedIn()) {
|
||||
ui = Gerrit.getUserAccount()
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.google.gerrit.client.account;
|
||||
import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DEFAULT_PAGESIZE;
|
||||
import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.PAGESIZE_CHOICES;
|
||||
|
||||
import com.google.gerrit.client.Dispatcher;
|
||||
import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.rpc.GerritCallback;
|
||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||
@@ -342,6 +343,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
public void onSuccess(final VoidResult result) {
|
||||
Gerrit.getUserAccount().setGeneralPreferences(p);
|
||||
Gerrit.applyUserPreferences();
|
||||
Dispatcher.changeScreen2 = false;
|
||||
enable(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user