From 9ed3450f6ae874ce9828a45680b736875acee4a7 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Tue, 6 Jan 2015 14:51:24 -0800 Subject: [PATCH] Remove gerrit.enableNewFeatures This was a hack inserted to support gerrit-review and friends when some UI features were not yet ready for mainstream use. Today all servers leave enableNewFeatures set to true, which means the branch conditions can simply be removed. Change-Id: Id75db4b340fed01a938bf09128f204c1d6799806 --- .../gerrit/common/data/GerritConfig.java | 9 ----- .../com/google/gerrit/client/Dispatcher.java | 6 +-- .../client/account/MyPreferencesScreen.java | 33 +++++++--------- .../client/changes/ChangeInfoBlock.java | 3 +- .../gerrit/client/changes/ChangeTable2.java | 39 ++++++++----------- .../gerrit/httpd/GerritConfigProvider.java | 2 - 6 files changed, 34 insertions(+), 58 deletions(-) diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java index a0602450b1..f76252fcaf 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java @@ -56,7 +56,6 @@ public class GerritConfig implements Cloneable { protected AccountGeneralPreferences.ChangeScreen changeScreen; protected List archiveFormats; protected int largeChangeSize; - protected boolean newFeatures; protected String replyLabel; protected String replyTitle; @@ -303,14 +302,6 @@ public class GerritConfig implements Cloneable { archiveFormats = formats; } - public boolean getNewFeatures() { - return newFeatures; - } - - public void setNewFeatures(boolean n) { - newFeatures = n; - } - public String getReplyTitle() { return replyTitle; } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java index a9cdbb36d9..8af7e74a0f 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java @@ -628,9 +628,7 @@ public class Dispatcher { } public static boolean isChangeScreen2() { - if (!Gerrit.getConfig().getNewFeatures()) { - return false; - } else if (changeScreen2) { + if (changeScreen2) { return true; } @@ -707,7 +705,7 @@ public class Dispatcher { sbs1(token, baseId, id, patchIndex, patchSetDetail, patchTable, topView, PatchScreen.Type.UNIFIED); return; - } else if ("cm".equals(panel) && Gerrit.getConfig().getNewFeatures()) { + } else if ("cm".equals(panel)) { if (Gerrit.isSignedIn() && DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount() .getGeneralPreferences().getDiffView())) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java index 6fb2fe06c4..9e78866721 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java @@ -196,32 +196,29 @@ public class MyPreferencesScreen extends SettingsScreen { formGrid.setWidget(row, fieldIdx, dateTimePanel); row++; - if (Gerrit.getConfig().getNewFeatures()) { - formGrid.setText(row, labelIdx, ""); - formGrid.setWidget(row, fieldIdx, relativeDateInChangeTable); - row++; + formGrid.setText(row, labelIdx, ""); + formGrid.setWidget(row, fieldIdx, relativeDateInChangeTable); + row++; - formGrid.setText(row, labelIdx, ""); - formGrid.setWidget(row, fieldIdx, sizeBarInChangeTable); - row++; + formGrid.setText(row, labelIdx, ""); + formGrid.setWidget(row, fieldIdx, sizeBarInChangeTable); + row++; - formGrid.setText(row, labelIdx, ""); - formGrid.setWidget(row, fieldIdx, legacycidInChangeTable); - row++; - } + formGrid.setText(row, labelIdx, ""); + formGrid.setWidget(row, fieldIdx, legacycidInChangeTable); + row++; formGrid.setText(row, labelIdx, Util.C.commentVisibilityLabel()); formGrid.setWidget(row, fieldIdx, commentVisibilityStrategy); row++; - if (Gerrit.getConfig().getNewFeatures()) { - formGrid.setText(row, labelIdx, Util.C.changeScreenLabel()); - formGrid.setWidget(row, fieldIdx, changeScreen); - row++; + formGrid.setText(row, labelIdx, Util.C.changeScreenLabel()); + formGrid.setWidget(row, fieldIdx, changeScreen); + row++; + + formGrid.setText(row, labelIdx, Util.C.diffViewLabel()); + formGrid.setWidget(row, fieldIdx, diffView); - formGrid.setText(row, labelIdx, Util.C.diffViewLabel()); - formGrid.setWidget(row, fieldIdx, diffView); - } add(formGrid); save = new Button(Util.C.buttonSaveChanges()); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java index 5f5cf8f9dd..a4f3145d3d 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java @@ -122,8 +122,7 @@ public class ChangeInfoBlock extends Composite { } table.setText(R_SUBMIT_TYPE, 1, submitType); final Change.Status status = chg.getStatus(); - if (Gerrit.getConfig().getNewFeatures() - && (status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT))) { + if (status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT)) { table.getRowFormatter().setVisible(R_MERGE_TEST, true); table.setText(R_MERGE_TEST, 1, changeDetail.isMergeable() ? Util.C .changeInfoBlockCanMergeYes() : Util.C.changeInfoBlockCanMergeNo()); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable2.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable2.java index ca7157afa5..57fba070fb 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable2.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable2.java @@ -59,15 +59,13 @@ public class ChangeTable2 extends NavigationTable { private static final int C_SIZE = 9; private static final int BASE_COLUMNS = 10; - - private final boolean useNewFeatures = Gerrit.getConfig().getNewFeatures(); private final List
sections; private int columns; private List labelNames; public ChangeTable2() { super(Util.C.changeItemHelp()); - columns = useNewFeatures ? BASE_COLUMNS : BASE_COLUMNS - 1; + columns = BASE_COLUMNS; labelNames = Collections.emptyList(); if (Gerrit.isSignedIn()) { @@ -83,9 +81,7 @@ public class ChangeTable2 extends NavigationTable { table.setText(0, C_PROJECT, Util.C.changeTableColumnProject()); table.setText(0, C_BRANCH, Util.C.changeTableColumnBranch()); table.setText(0, C_LAST_UPDATE, Util.C.changeTableColumnLastUpdate()); - if (useNewFeatures) { - table.setText(0, C_SIZE, Util.C.changeTableColumnSize()); - } + table.setText(0, C_SIZE, Util.C.changeTableColumnSize()); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(0, C_STAR, Gerrit.RESOURCES.css().iconHeader()); @@ -164,9 +160,7 @@ public class ChangeTable2 extends NavigationTable { } int i = C_SIZE; - if (useNewFeatures) { - fmt.addStyleName(row, i++, Gerrit.RESOURCES.css().cSIZE()); - } + fmt.addStyleName(row, i++, Gerrit.RESOURCES.css().cSIZE()); for (; i < columns; i++) { fmt.addStyleName(row, i, Gerrit.RESOURCES.css().cAPPROVAL()); } @@ -185,7 +179,7 @@ public class ChangeTable2 extends NavigationTable { } Collections.sort(labelNames); - int baseColumns = useNewFeatures ? BASE_COLUMNS : BASE_COLUMNS - 1; + int baseColumns = BASE_COLUMNS; if (baseColumns + labelNames.size() < columns) { int n = columns - (baseColumns + labelNames.size()); for (int row = 0; row < table.getRowCount(); row++) { @@ -228,7 +222,7 @@ public class ChangeTable2 extends NavigationTable { Change.Status status = c.status(); if (status != Change.Status.NEW) { table.setText(row, C_STATUS, Util.toLongString(status)); - } else if (!c.mergeable() && useNewFeatures) { + } else if (!c.mergeable()) { table.setText(row, C_STATUS, Util.C.changeTableNotMergeable()); } @@ -248,20 +242,19 @@ public class ChangeTable2 extends NavigationTable { } else { table.setText(row, C_LAST_UPDATE, shortFormat(c.updated())); } + int col = C_SIZE; - if (useNewFeatures) { - if (Gerrit.isSignedIn() - && !Gerrit.getUserAccount().getGeneralPreferences() - .isSizeBarInChangeTable()) { - table.setText(row, col, - Util.M.insertionsAndDeletions(c.insertions(), c.deletions())); - } else { - table.setWidget(row, col, getSizeWidget(c)); - fmt.getElement(row, col).setTitle( - Util.M.insertionsAndDeletions(c.insertions(), c.deletions())); - } - col++; + if (Gerrit.isSignedIn() + && !Gerrit.getUserAccount().getGeneralPreferences() + .isSizeBarInChangeTable()) { + table.setText(row, col, + Util.M.insertionsAndDeletions(c.insertions(), c.deletions())); + } else { + table.setWidget(row, col, getSizeWidget(c)); + fmt.getElement(row, col).setTitle( + Util.M.insertionsAndDeletions(c.insertions(), c.deletions())); } + col++; boolean displayInfo = Gerrit.isSignedIn() && Gerrit.getUserAccount() .getGeneralPreferences().isShowInfoInReviewCategory(); diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java index c4ca15d5a9..b727bc6cdb 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java @@ -146,8 +146,6 @@ class GerritConfigProvider implements Provider { } }))); - config.setNewFeatures(cfg.getBoolean("gerrit", "enableNewFeatures", true)); - config.setReportBugUrl(cfg.getString("gerrit", null, "reportBugUrl")); config.setReportBugText(cfg.getString("gerrit", null, "reportBugText"));