Merge "Replace "display name in review category" preference with a list of options"
This commit is contained in:
@@ -35,7 +35,11 @@ public interface AccountConstants extends Constants {
|
|||||||
String useFlashClipboard();
|
String useFlashClipboard();
|
||||||
String copySelfOnEmails();
|
String copySelfOnEmails();
|
||||||
String reversePatchSetOrder();
|
String reversePatchSetOrder();
|
||||||
String showUsernameInReviewCategory();
|
String reviewCategoryLabel();
|
||||||
|
String messageShowInReviewCategoryNone();
|
||||||
|
String messageShowInReviewCategoryName();
|
||||||
|
String messageShowInReviewCategoryEmail();
|
||||||
|
String messageShowInReviewCategoryAbbrev();
|
||||||
String buttonSaveChanges();
|
String buttonSaveChanges();
|
||||||
String showRelativeDateInChangeTable();
|
String showRelativeDateInChangeTable();
|
||||||
String showSizeBarInChangeTable();
|
String showSizeBarInChangeTable();
|
||||||
|
@@ -9,7 +9,13 @@ showSiteHeader = Show Site Header
|
|||||||
useFlashClipboard = Use Flash Clipboard Widget
|
useFlashClipboard = Use Flash Clipboard Widget
|
||||||
copySelfOnEmails = CC Me On Comments I Write
|
copySelfOnEmails = CC Me On Comments I Write
|
||||||
reversePatchSetOrder = Display Patch Sets In Reverse Order (deprecated: Old Change Screen)
|
reversePatchSetOrder = Display Patch Sets In Reverse Order (deprecated: Old Change Screen)
|
||||||
showUsernameInReviewCategory = Display Person Name In Review Category
|
|
||||||
|
reviewCategoryLabel = Display In Review Category
|
||||||
|
messageShowInReviewCategoryNone = None (default)
|
||||||
|
messageShowInReviewCategoryName = Show Name
|
||||||
|
messageShowInReviewCategoryEmail = Show Email
|
||||||
|
messageShowInReviewCategoryAbbrev = Show Abbreviation
|
||||||
|
|
||||||
maximumPageSizeFieldLabel = Maximum Page Size:
|
maximumPageSizeFieldLabel = Maximum Page Size:
|
||||||
commentVisibilityLabel = Comment Visibility (deprecated: Old Change Screen):
|
commentVisibilityLabel = Comment Visibility (deprecated: Old Change Screen):
|
||||||
changeScreenLabel = Change View:
|
changeScreenLabel = Change View:
|
||||||
|
@@ -28,6 +28,7 @@ import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
|||||||
import com.google.gerrit.client.ui.OnEditEnabler;
|
import com.google.gerrit.client.ui.OnEditEnabler;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
||||||
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy;
|
||||||
import com.google.gwt.core.client.JsArray;
|
import com.google.gwt.core.client.JsArray;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
@@ -49,13 +50,13 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
private CheckBox useFlashClipboard;
|
private CheckBox useFlashClipboard;
|
||||||
private CheckBox copySelfOnEmails;
|
private CheckBox copySelfOnEmails;
|
||||||
private CheckBox reversePatchSetOrder;
|
private CheckBox reversePatchSetOrder;
|
||||||
private CheckBox showUsernameInReviewCategory;
|
|
||||||
private CheckBox relativeDateInChangeTable;
|
private CheckBox relativeDateInChangeTable;
|
||||||
private CheckBox sizeBarInChangeTable;
|
private CheckBox sizeBarInChangeTable;
|
||||||
private CheckBox legacycidInChangeTable;
|
private CheckBox legacycidInChangeTable;
|
||||||
private ListBox maximumPageSize;
|
private ListBox maximumPageSize;
|
||||||
private ListBox dateFormat;
|
private ListBox dateFormat;
|
||||||
private ListBox timeFormat;
|
private ListBox timeFormat;
|
||||||
|
private ListBox reviewCategoryStrategy;
|
||||||
private ListBox commentVisibilityStrategy;
|
private ListBox commentVisibilityStrategy;
|
||||||
private ListBox changeScreen;
|
private ListBox changeScreen;
|
||||||
private ListBox diffView;
|
private ListBox diffView;
|
||||||
@@ -70,12 +71,25 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
useFlashClipboard = new CheckBox(Util.C.useFlashClipboard());
|
useFlashClipboard = new CheckBox(Util.C.useFlashClipboard());
|
||||||
copySelfOnEmails = new CheckBox(Util.C.copySelfOnEmails());
|
copySelfOnEmails = new CheckBox(Util.C.copySelfOnEmails());
|
||||||
reversePatchSetOrder = new CheckBox(Util.C.reversePatchSetOrder());
|
reversePatchSetOrder = new CheckBox(Util.C.reversePatchSetOrder());
|
||||||
showUsernameInReviewCategory = new CheckBox(Util.C.showUsernameInReviewCategory());
|
|
||||||
maximumPageSize = new ListBox();
|
maximumPageSize = new ListBox();
|
||||||
for (final short v : PAGESIZE_CHOICES) {
|
for (final short v : PAGESIZE_CHOICES) {
|
||||||
maximumPageSize.addItem(Util.M.rowsPerPage(v), String.valueOf(v));
|
maximumPageSize.addItem(Util.M.rowsPerPage(v), String.valueOf(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reviewCategoryStrategy = new ListBox();
|
||||||
|
reviewCategoryStrategy.addItem(
|
||||||
|
Util.C.messageShowInReviewCategoryNone(),
|
||||||
|
AccountGeneralPreferences.ReviewCategoryStrategy.NONE.name());
|
||||||
|
reviewCategoryStrategy.addItem(
|
||||||
|
Util.C.messageShowInReviewCategoryName(),
|
||||||
|
AccountGeneralPreferences.ReviewCategoryStrategy.NAME.name());
|
||||||
|
reviewCategoryStrategy.addItem(
|
||||||
|
Util.C.messageShowInReviewCategoryEmail(),
|
||||||
|
AccountGeneralPreferences.ReviewCategoryStrategy.EMAIL.name());
|
||||||
|
reviewCategoryStrategy.addItem(
|
||||||
|
Util.C.messageShowInReviewCategoryAbbrev(),
|
||||||
|
AccountGeneralPreferences.ReviewCategoryStrategy.ABBREV.name());
|
||||||
|
|
||||||
commentVisibilityStrategy = new ListBox();
|
commentVisibilityStrategy = new ListBox();
|
||||||
commentVisibilityStrategy.addItem(
|
commentVisibilityStrategy.addItem(
|
||||||
com.google.gerrit.client.changes.Util.C.messageCollapseAll(),
|
com.google.gerrit.client.changes.Util.C.messageCollapseAll(),
|
||||||
@@ -167,8 +181,8 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
formGrid.setWidget(row, fieldIdx, reversePatchSetOrder);
|
formGrid.setWidget(row, fieldIdx, reversePatchSetOrder);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
formGrid.setText(row, labelIdx, "");
|
formGrid.setText(row, labelIdx, Util.C.reviewCategoryLabel());
|
||||||
formGrid.setWidget(row, fieldIdx, showUsernameInReviewCategory);
|
formGrid.setWidget(row, fieldIdx, reviewCategoryStrategy);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
formGrid.setText(row, labelIdx, Util.C.maximumPageSizeFieldLabel());
|
formGrid.setText(row, labelIdx, Util.C.maximumPageSizeFieldLabel());
|
||||||
@@ -226,13 +240,13 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
e.listenTo(useFlashClipboard);
|
e.listenTo(useFlashClipboard);
|
||||||
e.listenTo(copySelfOnEmails);
|
e.listenTo(copySelfOnEmails);
|
||||||
e.listenTo(reversePatchSetOrder);
|
e.listenTo(reversePatchSetOrder);
|
||||||
e.listenTo(showUsernameInReviewCategory);
|
|
||||||
e.listenTo(maximumPageSize);
|
e.listenTo(maximumPageSize);
|
||||||
e.listenTo(dateFormat);
|
e.listenTo(dateFormat);
|
||||||
e.listenTo(timeFormat);
|
e.listenTo(timeFormat);
|
||||||
e.listenTo(relativeDateInChangeTable);
|
e.listenTo(relativeDateInChangeTable);
|
||||||
e.listenTo(sizeBarInChangeTable);
|
e.listenTo(sizeBarInChangeTable);
|
||||||
e.listenTo(legacycidInChangeTable);
|
e.listenTo(legacycidInChangeTable);
|
||||||
|
e.listenTo(reviewCategoryStrategy);
|
||||||
e.listenTo(commentVisibilityStrategy);
|
e.listenTo(commentVisibilityStrategy);
|
||||||
e.listenTo(changeScreen);
|
e.listenTo(changeScreen);
|
||||||
e.listenTo(diffView);
|
e.listenTo(diffView);
|
||||||
@@ -255,13 +269,13 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
useFlashClipboard.setEnabled(on);
|
useFlashClipboard.setEnabled(on);
|
||||||
copySelfOnEmails.setEnabled(on);
|
copySelfOnEmails.setEnabled(on);
|
||||||
reversePatchSetOrder.setEnabled(on);
|
reversePatchSetOrder.setEnabled(on);
|
||||||
showUsernameInReviewCategory.setEnabled(on);
|
|
||||||
maximumPageSize.setEnabled(on);
|
maximumPageSize.setEnabled(on);
|
||||||
dateFormat.setEnabled(on);
|
dateFormat.setEnabled(on);
|
||||||
timeFormat.setEnabled(on);
|
timeFormat.setEnabled(on);
|
||||||
relativeDateInChangeTable.setEnabled(on);
|
relativeDateInChangeTable.setEnabled(on);
|
||||||
sizeBarInChangeTable.setEnabled(on);
|
sizeBarInChangeTable.setEnabled(on);
|
||||||
legacycidInChangeTable.setEnabled(on);
|
legacycidInChangeTable.setEnabled(on);
|
||||||
|
reviewCategoryStrategy.setEnabled(on);
|
||||||
commentVisibilityStrategy.setEnabled(on);
|
commentVisibilityStrategy.setEnabled(on);
|
||||||
changeScreen.setEnabled(on);
|
changeScreen.setEnabled(on);
|
||||||
diffView.setEnabled(on);
|
diffView.setEnabled(on);
|
||||||
@@ -272,7 +286,6 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
useFlashClipboard.setValue(p.useFlashClipboard());
|
useFlashClipboard.setValue(p.useFlashClipboard());
|
||||||
copySelfOnEmails.setValue(p.copySelfOnEmail());
|
copySelfOnEmails.setValue(p.copySelfOnEmail());
|
||||||
reversePatchSetOrder.setValue(p.reversePatchSetOrder());
|
reversePatchSetOrder.setValue(p.reversePatchSetOrder());
|
||||||
showUsernameInReviewCategory.setValue(p.showUsernameInReviewCategory());
|
|
||||||
setListBox(maximumPageSize, DEFAULT_PAGESIZE, p.changesPerPage());
|
setListBox(maximumPageSize, DEFAULT_PAGESIZE, p.changesPerPage());
|
||||||
setListBox(dateFormat, AccountGeneralPreferences.DateFormat.STD, //
|
setListBox(dateFormat, AccountGeneralPreferences.DateFormat.STD, //
|
||||||
p.dateFormat());
|
p.dateFormat());
|
||||||
@@ -281,6 +294,9 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
relativeDateInChangeTable.setValue(p.relativeDateInChangeTable());
|
relativeDateInChangeTable.setValue(p.relativeDateInChangeTable());
|
||||||
sizeBarInChangeTable.setValue(p.sizeBarInChangeTable());
|
sizeBarInChangeTable.setValue(p.sizeBarInChangeTable());
|
||||||
legacycidInChangeTable.setValue(p.legacycidInChangeTable());
|
legacycidInChangeTable.setValue(p.legacycidInChangeTable());
|
||||||
|
setListBox(reviewCategoryStrategy,
|
||||||
|
AccountGeneralPreferences.ReviewCategoryStrategy.NONE,
|
||||||
|
p.reviewCategoryStrategy());
|
||||||
setListBox(commentVisibilityStrategy,
|
setListBox(commentVisibilityStrategy,
|
||||||
AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT,
|
AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT,
|
||||||
p.commentVisibilityStrategy());
|
p.commentVisibilityStrategy());
|
||||||
@@ -358,7 +374,6 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
p.setUseFlashClipboard(useFlashClipboard.getValue());
|
p.setUseFlashClipboard(useFlashClipboard.getValue());
|
||||||
p.setCopySelfOnEmails(copySelfOnEmails.getValue());
|
p.setCopySelfOnEmails(copySelfOnEmails.getValue());
|
||||||
p.setReversePatchSetOrder(reversePatchSetOrder.getValue());
|
p.setReversePatchSetOrder(reversePatchSetOrder.getValue());
|
||||||
p.setShowUsernameInReviewCategory(showUsernameInReviewCategory.getValue());
|
|
||||||
p.setMaximumPageSize(getListBox(maximumPageSize, DEFAULT_PAGESIZE));
|
p.setMaximumPageSize(getListBox(maximumPageSize, DEFAULT_PAGESIZE));
|
||||||
p.setDateFormat(getListBox(dateFormat,
|
p.setDateFormat(getListBox(dateFormat,
|
||||||
AccountGeneralPreferences.DateFormat.STD,
|
AccountGeneralPreferences.DateFormat.STD,
|
||||||
@@ -369,6 +384,9 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
p.setRelativeDateInChangeTable(relativeDateInChangeTable.getValue());
|
p.setRelativeDateInChangeTable(relativeDateInChangeTable.getValue());
|
||||||
p.setSizeBarInChangeTable(sizeBarInChangeTable.getValue());
|
p.setSizeBarInChangeTable(sizeBarInChangeTable.getValue());
|
||||||
p.setLegacycidInChangeTable(legacycidInChangeTable.getValue());
|
p.setLegacycidInChangeTable(legacycidInChangeTable.getValue());
|
||||||
|
p.setReviewCategoryStrategy(getListBox(reviewCategoryStrategy,
|
||||||
|
ReviewCategoryStrategy.NONE,
|
||||||
|
ReviewCategoryStrategy.values()));
|
||||||
p.setCommentVisibilityStrategy(getListBox(commentVisibilityStrategy,
|
p.setCommentVisibilityStrategy(getListBox(commentVisibilityStrategy,
|
||||||
CommentVisibilityStrategy.EXPAND_RECENT,
|
CommentVisibilityStrategy.EXPAND_RECENT,
|
||||||
CommentVisibilityStrategy.values()));
|
CommentVisibilityStrategy.values()));
|
||||||
|
@@ -18,6 +18,7 @@ import com.google.gerrit.client.extensions.TopMenuItem;
|
|||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
||||||
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
|
||||||
@@ -43,11 +44,11 @@ public class Preferences extends JavaScriptObject {
|
|||||||
p.dateFormat(in.getDateFormat());
|
p.dateFormat(in.getDateFormat());
|
||||||
p.timeFormat(in.getTimeFormat());
|
p.timeFormat(in.getTimeFormat());
|
||||||
p.reversePatchSetOrder(in.isReversePatchSetOrder());
|
p.reversePatchSetOrder(in.isReversePatchSetOrder());
|
||||||
p.showUsernameInReviewCategory(in.isShowUsernameInReviewCategory());
|
|
||||||
p.relativeDateInChangeTable(in.isRelativeDateInChangeTable());
|
p.relativeDateInChangeTable(in.isRelativeDateInChangeTable());
|
||||||
p.sizeBarInChangeTable(in.isSizeBarInChangeTable());
|
p.sizeBarInChangeTable(in.isSizeBarInChangeTable());
|
||||||
p.legacycidInChangeTable(in.isLegacycidInChangeTable());
|
p.legacycidInChangeTable(in.isLegacycidInChangeTable());
|
||||||
p.commentVisibilityStrategy(in.getCommentVisibilityStrategy());
|
p.commentVisibilityStrategy(in.getCommentVisibilityStrategy());
|
||||||
|
p.reviewCategoryStrategy(in.getReviewCategoryStrategy());
|
||||||
p.diffView(in.getDiffView());
|
p.diffView(in.getDiffView());
|
||||||
p.changeScreen(in.getChangeScreen());
|
p.changeScreen(in.getChangeScreen());
|
||||||
p.setMyMenus(myMenus);
|
p.setMyMenus(myMenus);
|
||||||
@@ -100,9 +101,6 @@ public class Preferences extends JavaScriptObject {
|
|||||||
public final native boolean reversePatchSetOrder()
|
public final native boolean reversePatchSetOrder()
|
||||||
/*-{ return this.reverse_patch_set_order || false }-*/;
|
/*-{ return this.reverse_patch_set_order || false }-*/;
|
||||||
|
|
||||||
public final native boolean showUsernameInReviewCategory()
|
|
||||||
/*-{ return this.show_username_in_review_category || false }-*/;
|
|
||||||
|
|
||||||
public final native boolean relativeDateInChangeTable()
|
public final native boolean relativeDateInChangeTable()
|
||||||
/*-{ return this.relative_date_in_change_table || false }-*/;
|
/*-{ return this.relative_date_in_change_table || false }-*/;
|
||||||
|
|
||||||
@@ -112,6 +110,13 @@ public class Preferences extends JavaScriptObject {
|
|||||||
public final native boolean legacycidInChangeTable()
|
public final native boolean legacycidInChangeTable()
|
||||||
/*-{ return this.legacycid_in_change_table || false }-*/;
|
/*-{ return this.legacycid_in_change_table || false }-*/;
|
||||||
|
|
||||||
|
public final ReviewCategoryStrategy reviewCategoryStrategy() {
|
||||||
|
String s = reviewCategeoryStrategyRaw();
|
||||||
|
return s != null ? ReviewCategoryStrategy.valueOf(s) : ReviewCategoryStrategy.NONE;
|
||||||
|
}
|
||||||
|
private final native String reviewCategeoryStrategyRaw()
|
||||||
|
/*-{ return this.review_category_strategy }-*/;
|
||||||
|
|
||||||
public final CommentVisibilityStrategy commentVisibilityStrategy() {
|
public final CommentVisibilityStrategy commentVisibilityStrategy() {
|
||||||
String s = commentVisibilityStrategyRaw();
|
String s = commentVisibilityStrategyRaw();
|
||||||
return s != null ? CommentVisibilityStrategy.valueOf(s) : null;
|
return s != null ? CommentVisibilityStrategy.valueOf(s) : null;
|
||||||
@@ -175,9 +180,6 @@ public class Preferences extends JavaScriptObject {
|
|||||||
public final native void reversePatchSetOrder(boolean r)
|
public final native void reversePatchSetOrder(boolean r)
|
||||||
/*-{ this.reverse_patch_set_order = r }-*/;
|
/*-{ this.reverse_patch_set_order = r }-*/;
|
||||||
|
|
||||||
public final native void showUsernameInReviewCategory(boolean s)
|
|
||||||
/*-{ this.show_username_in_review_category = s }-*/;
|
|
||||||
|
|
||||||
public final native void relativeDateInChangeTable(boolean d)
|
public final native void relativeDateInChangeTable(boolean d)
|
||||||
/*-{ this.relative_date_in_change_table = d }-*/;
|
/*-{ this.relative_date_in_change_table = d }-*/;
|
||||||
|
|
||||||
@@ -187,6 +189,12 @@ public class Preferences extends JavaScriptObject {
|
|||||||
public final native void legacycidInChangeTable(boolean s)
|
public final native void legacycidInChangeTable(boolean s)
|
||||||
/*-{ this.legacycid_in_change_table = s }-*/;
|
/*-{ this.legacycid_in_change_table = s }-*/;
|
||||||
|
|
||||||
|
public final void reviewCategoryStrategy(ReviewCategoryStrategy s) {
|
||||||
|
reviewCategoryStrategyRaw(s != null ? s.toString() : null);
|
||||||
|
}
|
||||||
|
private final native void reviewCategoryStrategyRaw(String s)
|
||||||
|
/*-{ this.review_category_strategy = s }-*/;
|
||||||
|
|
||||||
public final void commentVisibilityStrategy(CommentVisibilityStrategy s) {
|
public final void commentVisibilityStrategy(CommentVisibilityStrategy s) {
|
||||||
commentVisibilityStrategyRaw(s != null ? s.toString() : null);
|
commentVisibilityStrategyRaw(s != null ? s.toString() : null);
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,8 @@ import java.util.EnumSet;
|
|||||||
/** List of changes available from {@code /changes/}. */
|
/** List of changes available from {@code /changes/}. */
|
||||||
public class ChangeList extends JsArray<ChangeInfo> {
|
public class ChangeList extends JsArray<ChangeInfo> {
|
||||||
private static final String URI = "/changes/";
|
private static final String URI = "/changes/";
|
||||||
|
private static final EnumSet<ListChangesOption> OPTIONS = EnumSet.of(
|
||||||
|
ListChangesOption.LABELS, ListChangesOption.DETAILED_ACCOUNTS);
|
||||||
|
|
||||||
/** Run 2 or more queries in a single remote invocation. */
|
/** Run 2 or more queries in a single remote invocation. */
|
||||||
public static void query(
|
public static void query(
|
||||||
@@ -36,10 +38,8 @@ public class ChangeList extends JsArray<ChangeInfo> {
|
|||||||
for (String q : queries) {
|
for (String q : queries) {
|
||||||
call.addParameterRaw("q", KeyUtil.encode(q));
|
call.addParameterRaw("q", KeyUtil.encode(q));
|
||||||
}
|
}
|
||||||
|
OPTIONS.addAll(options);
|
||||||
EnumSet<ListChangesOption> o = EnumSet.of(ListChangesOption.LABELS);
|
addOptions(call, OPTIONS);
|
||||||
o.addAll(options);
|
|
||||||
addOptions(call, o);
|
|
||||||
call.get(callback);
|
call.get(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class ChangeList extends JsArray<ChangeInfo> {
|
|||||||
if (limit > 0) {
|
if (limit > 0) {
|
||||||
call.addParameter("n", limit);
|
call.addParameter("n", limit);
|
||||||
}
|
}
|
||||||
addOptions(call, EnumSet.of(ListChangesOption.LABELS));
|
addOptions(call, OPTIONS);
|
||||||
if (start != 0) {
|
if (start != 0) {
|
||||||
call.addParameter("S", start);
|
call.addParameter("S", start);
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ import static com.google.gerrit.client.FormatUtil.shortFormat;
|
|||||||
|
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.changes.ChangeInfo.LabelInfo;
|
import com.google.gerrit.client.changes.ChangeInfo.LabelInfo;
|
||||||
|
import com.google.gerrit.client.account.AccountInfo;
|
||||||
import com.google.gerrit.client.ui.AccountLinkPanel;
|
import com.google.gerrit.client.ui.AccountLinkPanel;
|
||||||
import com.google.gerrit.client.ui.BranchLink;
|
import com.google.gerrit.client.ui.BranchLink;
|
||||||
import com.google.gerrit.client.ui.ChangeLink;
|
import com.google.gerrit.client.ui.ChangeLink;
|
||||||
@@ -26,6 +27,7 @@ import com.google.gerrit.client.ui.NavigationTable;
|
|||||||
import com.google.gerrit.client.ui.NeedsSignInKeyCommand;
|
import com.google.gerrit.client.ui.NeedsSignInKeyCommand;
|
||||||
import com.google.gerrit.client.ui.ProjectLink;
|
import com.google.gerrit.client.ui.ProjectLink;
|
||||||
import com.google.gerrit.common.PageLinks;
|
import com.google.gerrit.common.PageLinks;
|
||||||
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy;
|
||||||
import com.google.gerrit.reviewdb.client.Change;
|
import com.google.gerrit.reviewdb.client.Change;
|
||||||
import com.google.gwt.dom.client.Element;
|
import com.google.gwt.dom.client.Element;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
@@ -197,11 +199,8 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
|||||||
String name = labelNames.get(i);
|
String name = labelNames.get(i);
|
||||||
int col = baseColumns + i;
|
int col = baseColumns + i;
|
||||||
|
|
||||||
StringBuilder abbrev = new StringBuilder();
|
String abbrev = getAbbreviation(name, "-");
|
||||||
for (String t : name.split("-")) {
|
table.setText(0, col, abbrev);
|
||||||
abbrev.append(t.substring(0, 1).toUpperCase());
|
|
||||||
}
|
|
||||||
table.setText(0, col, abbrev.toString());
|
|
||||||
table.getCellFormatter().getElement(0, col).setTitle(name);
|
table.getCellFormatter().getElement(0, col).setTitle(name);
|
||||||
fmt.addStyleName(0, col, Gerrit.RESOURCES.css().dataHeader());
|
fmt.addStyleName(0, col, Gerrit.RESOURCES.css().dataHeader());
|
||||||
}
|
}
|
||||||
@@ -264,8 +263,8 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
|||||||
col++;
|
col++;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean displayName = Gerrit.isSignedIn() && Gerrit.getUserAccount()
|
boolean displayInfo = Gerrit.isSignedIn() && Gerrit.getUserAccount()
|
||||||
.getGeneralPreferences().isShowUsernameInReviewCategory();
|
.getGeneralPreferences().isShowInfoInReviewCategory();
|
||||||
|
|
||||||
for (int idx = 0; idx < labelNames.size(); idx++, col++) {
|
for (int idx = 0; idx < labelNames.size(); idx++, col++) {
|
||||||
String name = labelNames.get(idx);
|
String name = labelNames.get(idx);
|
||||||
@@ -278,9 +277,14 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String user;
|
String user;
|
||||||
|
ReviewCategoryStrategy reviewCategoryStrategy = Gerrit.isSignedIn()
|
||||||
|
? Gerrit.getUserAccount().getGeneralPreferences()
|
||||||
|
.getReviewCategoryStrategy()
|
||||||
|
: ReviewCategoryStrategy.NONE;
|
||||||
if (label.rejected() != null) {
|
if (label.rejected() != null) {
|
||||||
user = label.rejected().name();
|
user = getReviewCategoryDisplayInfo(reviewCategoryStrategy,
|
||||||
if (displayName && user != null) {
|
label.rejected());
|
||||||
|
if (displayInfo && user != null) {
|
||||||
FlowPanel panel = new FlowPanel();
|
FlowPanel panel = new FlowPanel();
|
||||||
panel.add(new Image(Gerrit.RESOURCES.redNot()));
|
panel.add(new Image(Gerrit.RESOURCES.redNot()));
|
||||||
panel.add(new InlineLabel(user));
|
panel.add(new InlineLabel(user));
|
||||||
@@ -289,8 +293,9 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
|||||||
table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot()));
|
table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot()));
|
||||||
}
|
}
|
||||||
} else if (label.approved() != null) {
|
} else if (label.approved() != null) {
|
||||||
user = label.approved().name();
|
user = getReviewCategoryDisplayInfo(reviewCategoryStrategy,
|
||||||
if (displayName && user != null) {
|
label.approved());
|
||||||
|
if (displayInfo && user != null) {
|
||||||
FlowPanel panel = new FlowPanel();
|
FlowPanel panel = new FlowPanel();
|
||||||
panel.add(new Image(Gerrit.RESOURCES.greenCheck()));
|
panel.add(new Image(Gerrit.RESOURCES.greenCheck()));
|
||||||
panel.add(new InlineLabel(user));
|
panel.add(new InlineLabel(user));
|
||||||
@@ -299,17 +304,19 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
|||||||
table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));
|
table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));
|
||||||
}
|
}
|
||||||
} else if (label.disliked() != null) {
|
} else if (label.disliked() != null) {
|
||||||
user = label.disliked().name();
|
user = getReviewCategoryDisplayInfo(reviewCategoryStrategy,
|
||||||
|
label.disliked());
|
||||||
String vstr = String.valueOf(label._value());
|
String vstr = String.valueOf(label._value());
|
||||||
if (displayName && user != null) {
|
if (displayInfo && user != null) {
|
||||||
vstr = vstr + " " + user;
|
vstr = vstr + " " + user;
|
||||||
}
|
}
|
||||||
fmt.addStyleName(row, col, Gerrit.RESOURCES.css().negscore());
|
fmt.addStyleName(row, col, Gerrit.RESOURCES.css().negscore());
|
||||||
table.setText(row, col, vstr);
|
table.setText(row, col, vstr);
|
||||||
} else if (label.recommended() != null) {
|
} else if (label.recommended() != null) {
|
||||||
user = label.recommended().name();
|
user = getReviewCategoryDisplayInfo(reviewCategoryStrategy,
|
||||||
|
label.recommended());
|
||||||
String vstr = "+" + label._value();
|
String vstr = "+" + label._value();
|
||||||
if (displayName && user != null) {
|
if (displayInfo && user != null) {
|
||||||
vstr = vstr + " " + user;
|
vstr = vstr + " " + user;
|
||||||
}
|
}
|
||||||
fmt.addStyleName(row, col, Gerrit.RESOURCES.css().posscore());
|
fmt.addStyleName(row, col, Gerrit.RESOURCES.css().posscore());
|
||||||
@@ -320,7 +327,7 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
|||||||
}
|
}
|
||||||
fmt.addStyleName(row, col, Gerrit.RESOURCES.css().singleLine());
|
fmt.addStyleName(row, col, Gerrit.RESOURCES.css().singleLine());
|
||||||
|
|
||||||
if (!displayName && user != null) {
|
if (!displayInfo && user != null) {
|
||||||
// Some web browsers ignore the embedded newline; some like it;
|
// Some web browsers ignore the embedded newline; some like it;
|
||||||
// so we include a space before the newline to accommodate both.
|
// so we include a space before the newline to accommodate both.
|
||||||
fmt.getElement(row, col).setTitle(name + " \nby " + user);
|
fmt.getElement(row, col).setTitle(name + " \nby " + user);
|
||||||
@@ -338,6 +345,30 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
|||||||
setRowItem(row, c);
|
setRowItem(row, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getReviewCategoryDisplayInfo(
|
||||||
|
ReviewCategoryStrategy reviewCategoryStrategy, AccountInfo accountInfo) {
|
||||||
|
switch (reviewCategoryStrategy) {
|
||||||
|
case NAME:
|
||||||
|
return accountInfo.name();
|
||||||
|
case EMAIL:
|
||||||
|
return accountInfo.email();
|
||||||
|
case ABBREV:
|
||||||
|
return getAbbreviation(accountInfo.name(), " ");
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getAbbreviation(String name, String token) {
|
||||||
|
StringBuilder abbrev = new StringBuilder();
|
||||||
|
if (name != null) {
|
||||||
|
for (String t : name.split(token)) {
|
||||||
|
abbrev.append(t.substring(0, 1).toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return abbrev.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private static Widget getSizeWidget(ChangeInfo c) {
|
private static Widget getSizeWidget(ChangeInfo c) {
|
||||||
int largeChangeSize = Gerrit.getConfig().getLargeChangeSize();
|
int largeChangeSize = Gerrit.getConfig().getLargeChangeSize();
|
||||||
int changedLines = c.insertions() + c.deletions();
|
int changedLines = c.insertions() + c.deletions();
|
||||||
|
@@ -75,6 +75,13 @@ public final class AccountGeneralPreferences {
|
|||||||
EXPAND_ALL
|
EXPAND_ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static enum ReviewCategoryStrategy {
|
||||||
|
NONE,
|
||||||
|
NAME,
|
||||||
|
EMAIL,
|
||||||
|
ABBREV
|
||||||
|
}
|
||||||
|
|
||||||
public static enum DiffView {
|
public static enum DiffView {
|
||||||
SIDE_BY_SIDE,
|
SIDE_BY_SIDE,
|
||||||
UNIFIED_DIFF
|
UNIFIED_DIFF
|
||||||
@@ -146,9 +153,6 @@ public final class AccountGeneralPreferences {
|
|||||||
@Column(id = 10)
|
@Column(id = 10)
|
||||||
protected boolean reversePatchSetOrder;
|
protected boolean reversePatchSetOrder;
|
||||||
|
|
||||||
@Column(id = 11)
|
|
||||||
protected boolean showUserInReview;
|
|
||||||
|
|
||||||
@Column(id = 12)
|
@Column(id = 12)
|
||||||
protected boolean relativeDateInChangeTable;
|
protected boolean relativeDateInChangeTable;
|
||||||
|
|
||||||
@@ -167,6 +171,9 @@ public final class AccountGeneralPreferences {
|
|||||||
@Column(id = 17)
|
@Column(id = 17)
|
||||||
protected boolean legacycidInChangeTable;
|
protected boolean legacycidInChangeTable;
|
||||||
|
|
||||||
|
@Column(id = 18, length = 20, notNull = false)
|
||||||
|
protected String reviewCategoryStrategy;
|
||||||
|
|
||||||
public AccountGeneralPreferences() {
|
public AccountGeneralPreferences() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,12 +247,8 @@ public final class AccountGeneralPreferences {
|
|||||||
this.reversePatchSetOrder = reversePatchSetOrder;
|
this.reversePatchSetOrder = reversePatchSetOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowUsernameInReviewCategory() {
|
public boolean isShowInfoInReviewCategory() {
|
||||||
return showUserInReview;
|
return getReviewCategoryStrategy() != ReviewCategoryStrategy.NONE;
|
||||||
}
|
|
||||||
|
|
||||||
public void setShowUsernameInReviewCategory(final boolean showUsernameInReviewCategory) {
|
|
||||||
this.showUserInReview = showUsernameInReviewCategory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateFormat getDateFormat() {
|
public DateFormat getDateFormat() {
|
||||||
@@ -278,6 +281,18 @@ public final class AccountGeneralPreferences {
|
|||||||
this.relativeDateInChangeTable = relativeDateInChangeTable;
|
this.relativeDateInChangeTable = relativeDateInChangeTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReviewCategoryStrategy getReviewCategoryStrategy() {
|
||||||
|
if (reviewCategoryStrategy == null) {
|
||||||
|
return ReviewCategoryStrategy.NONE;
|
||||||
|
}
|
||||||
|
return ReviewCategoryStrategy.valueOf(reviewCategoryStrategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReviewCategoryStrategy(
|
||||||
|
ReviewCategoryStrategy strategy) {
|
||||||
|
reviewCategoryStrategy = strategy.name();
|
||||||
|
}
|
||||||
|
|
||||||
public CommentVisibilityStrategy getCommentVisibilityStrategy() {
|
public CommentVisibilityStrategy getCommentVisibilityStrategy() {
|
||||||
if (commentVisibilityStrategy == null) {
|
if (commentVisibilityStrategy == null) {
|
||||||
return CommentVisibilityStrategy.EXPAND_RECENT;
|
return CommentVisibilityStrategy.EXPAND_RECENT;
|
||||||
@@ -331,7 +346,7 @@ public final class AccountGeneralPreferences {
|
|||||||
useFlashClipboard = true;
|
useFlashClipboard = true;
|
||||||
copySelfOnEmail = false;
|
copySelfOnEmail = false;
|
||||||
reversePatchSetOrder = false;
|
reversePatchSetOrder = false;
|
||||||
showUserInReview = false;
|
reviewCategoryStrategy = null;
|
||||||
downloadUrl = null;
|
downloadUrl = null;
|
||||||
downloadCommand = null;
|
downloadCommand = null;
|
||||||
dateFormat = null;
|
dateFormat = null;
|
||||||
|
@@ -23,6 +23,7 @@ import com.google.gerrit.reviewdb.client.Account;
|
|||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
||||||
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
|
||||||
@@ -108,10 +109,10 @@ public class GetPreferences implements RestReadView<AccountResource> {
|
|||||||
DateFormat dateFormat;
|
DateFormat dateFormat;
|
||||||
TimeFormat timeFormat;
|
TimeFormat timeFormat;
|
||||||
Boolean reversePatchSetOrder;
|
Boolean reversePatchSetOrder;
|
||||||
Boolean showUsernameInReviewCategory;
|
|
||||||
Boolean relativeDateInChangeTable;
|
Boolean relativeDateInChangeTable;
|
||||||
Boolean sizeBarInChangeTable;
|
Boolean sizeBarInChangeTable;
|
||||||
Boolean legacycidInChangeTable;
|
Boolean legacycidInChangeTable;
|
||||||
|
ReviewCategoryStrategy reviewCategoryStrategy;
|
||||||
CommentVisibilityStrategy commentVisibilityStrategy;
|
CommentVisibilityStrategy commentVisibilityStrategy;
|
||||||
DiffView diffView;
|
DiffView diffView;
|
||||||
ChangeScreen changeScreen;
|
ChangeScreen changeScreen;
|
||||||
@@ -129,10 +130,10 @@ public class GetPreferences implements RestReadView<AccountResource> {
|
|||||||
dateFormat = p.getDateFormat();
|
dateFormat = p.getDateFormat();
|
||||||
timeFormat = p.getTimeFormat();
|
timeFormat = p.getTimeFormat();
|
||||||
reversePatchSetOrder = p.isReversePatchSetOrder() ? true : null;
|
reversePatchSetOrder = p.isReversePatchSetOrder() ? true : null;
|
||||||
showUsernameInReviewCategory = p.isShowUsernameInReviewCategory() ? true : null;
|
|
||||||
relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null;
|
relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null;
|
||||||
sizeBarInChangeTable = p.isSizeBarInChangeTable() ? true : null;
|
sizeBarInChangeTable = p.isSizeBarInChangeTable() ? true : null;
|
||||||
legacycidInChangeTable = p.isLegacycidInChangeTable() ? true : null;
|
legacycidInChangeTable = p.isLegacycidInChangeTable() ? true : null;
|
||||||
|
reviewCategoryStrategy = p.getReviewCategoryStrategy();
|
||||||
commentVisibilityStrategy = p.getCommentVisibilityStrategy();
|
commentVisibilityStrategy = p.getCommentVisibilityStrategy();
|
||||||
diffView = p.getDiffView();
|
diffView = p.getDiffView();
|
||||||
changeScreen = p.getChangeScreen();
|
changeScreen = p.getChangeScreen();
|
||||||
|
@@ -28,6 +28,7 @@ import com.google.gerrit.reviewdb.client.Account;
|
|||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
||||||
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
|
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
|
||||||
@@ -62,11 +63,11 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
|||||||
public DateFormat dateFormat;
|
public DateFormat dateFormat;
|
||||||
public TimeFormat timeFormat;
|
public TimeFormat timeFormat;
|
||||||
public Boolean reversePatchSetOrder;
|
public Boolean reversePatchSetOrder;
|
||||||
public Boolean showUsernameInReviewCategory;
|
|
||||||
public Boolean relativeDateInChangeTable;
|
public Boolean relativeDateInChangeTable;
|
||||||
public Boolean sizeBarInChangeTable;
|
public Boolean sizeBarInChangeTable;
|
||||||
public Boolean legacycidInChangeTable;
|
public Boolean legacycidInChangeTable;
|
||||||
public CommentVisibilityStrategy commentVisibilityStrategy;
|
public CommentVisibilityStrategy commentVisibilityStrategy;
|
||||||
|
public ReviewCategoryStrategy reviewCategoryStrategy;
|
||||||
public DiffView diffView;
|
public DiffView diffView;
|
||||||
public ChangeScreen changeScreen;
|
public ChangeScreen changeScreen;
|
||||||
public List<TopMenu.MenuItem> my;
|
public List<TopMenu.MenuItem> my;
|
||||||
@@ -148,9 +149,6 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
|||||||
if (i.reversePatchSetOrder != null) {
|
if (i.reversePatchSetOrder != null) {
|
||||||
p.setReversePatchSetOrder(i.reversePatchSetOrder);
|
p.setReversePatchSetOrder(i.reversePatchSetOrder);
|
||||||
}
|
}
|
||||||
if (i.showUsernameInReviewCategory != null) {
|
|
||||||
p.setShowUsernameInReviewCategory(i.showUsernameInReviewCategory);
|
|
||||||
}
|
|
||||||
if (i.relativeDateInChangeTable != null) {
|
if (i.relativeDateInChangeTable != null) {
|
||||||
p.setRelativeDateInChangeTable(i.relativeDateInChangeTable);
|
p.setRelativeDateInChangeTable(i.relativeDateInChangeTable);
|
||||||
}
|
}
|
||||||
@@ -160,6 +158,9 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
|||||||
if (i.legacycidInChangeTable != null) {
|
if (i.legacycidInChangeTable != null) {
|
||||||
p.setLegacycidInChangeTable(i.legacycidInChangeTable);
|
p.setLegacycidInChangeTable(i.legacycidInChangeTable);
|
||||||
}
|
}
|
||||||
|
if (i.reviewCategoryStrategy != null) {
|
||||||
|
p.setReviewCategoryStrategy(i.reviewCategoryStrategy);
|
||||||
|
}
|
||||||
if (i.commentVisibilityStrategy != null) {
|
if (i.commentVisibilityStrategy != null) {
|
||||||
p.setCommentVisibilityStrategy(i.commentVisibilityStrategy);
|
p.setCommentVisibilityStrategy(i.commentVisibilityStrategy);
|
||||||
}
|
}
|
||||||
|
@@ -50,10 +50,10 @@ public class SetPreferences implements RestModifyView<ConfigResource, Input> {
|
|||||||
|| i.downloadCommand != null || i.copySelfOnEmail != null
|
|| i.downloadCommand != null || i.copySelfOnEmail != null
|
||||||
|| i.dateFormat != null || i.timeFormat != null
|
|| i.dateFormat != null || i.timeFormat != null
|
||||||
|| i.reversePatchSetOrder != null
|
|| i.reversePatchSetOrder != null
|
||||||
|| i.showUsernameInReviewCategory != null
|
|
||||||
|| i.relativeDateInChangeTable != null
|
|| i.relativeDateInChangeTable != null
|
||||||
|| i.sizeBarInChangeTable != null
|
|| i.sizeBarInChangeTable != null
|
||||||
|| i.legacycidInChangeTable != null
|
|| i.legacycidInChangeTable != null
|
||||||
|
|| i.reviewCategoryStrategy != null
|
||||||
|| i.commentVisibilityStrategy != null || i.diffView != null
|
|| i.commentVisibilityStrategy != null || i.diffView != null
|
||||||
|| i.changeScreen != null) {
|
|| i.changeScreen != null) {
|
||||||
throw new BadRequestException("unsupported option");
|
throw new BadRequestException("unsupported option");
|
||||||
|
@@ -32,7 +32,7 @@ import java.util.List;
|
|||||||
/** A version of the database schema. */
|
/** A version of the database schema. */
|
||||||
public abstract class SchemaVersion {
|
public abstract class SchemaVersion {
|
||||||
/** The current schema version. */
|
/** The current schema version. */
|
||||||
public static final Class<Schema_97> C = Schema_97.class;
|
public static final Class<Schema_98> C = Schema_98.class;
|
||||||
|
|
||||||
public static class Module extends AbstractModule {
|
public static class Module extends AbstractModule {
|
||||||
@Override
|
@Override
|
||||||
|
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (C) 2014 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.server.schema;
|
||||||
|
|
||||||
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
|
import com.google.gwtorm.jdbc.JdbcSchema;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Provider;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
|
||||||
|
public class Schema_98 extends SchemaVersion {
|
||||||
|
@Inject
|
||||||
|
Schema_98(Provider<Schema_97> prior) {
|
||||||
|
super(prior);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void migrateData(ReviewDb db, UpdateUI ui) throws SQLException {
|
||||||
|
ui.message("Migrate user preference showUserInReview to "
|
||||||
|
+ "reviewCategoryStrategy");
|
||||||
|
Statement stmt = ((JdbcSchema) db).getConnection().createStatement();
|
||||||
|
try {
|
||||||
|
stmt.executeUpdate("UPDATE ACCOUNTS SET "
|
||||||
|
+ "REVIEW_CATEGORY_STRATEGY='NAME' "
|
||||||
|
+ "WHERE (SHOW_USER_IN_REVIEW='Y')");
|
||||||
|
} finally {
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user