Leave assignee feature always enabled

The assignee feature cannot be disabled and thus does not make
so much sense to just show and hide some parts of it here and there
on the Gerrit UX.

Leave only the possibility to enable/disable the display of
the assignee field as column in the changes table.

Change-Id: Icbfb93a49f29b2fde60b92b448862216861108d1
This commit is contained in:
Luca Milanesio 2017-04-10 10:59:34 +01:00
parent 70fbef858e
commit f2a275b82d
8 changed files with 11 additions and 38 deletions

View File

@ -1022,25 +1022,13 @@ performance improvements by reducing the number of refs in the repo.
+
Default is true.
[[change.showAssignee]]change.showAssignee::
[[change.showAssigneeInChangesTable]]change.showAssigneeInChangesTable::
+
Show assignee field in changes table. If set to false, assignees will
not be visible in changes table.
+
Default is false.
[[change.showAssigneeSuggestOracle]]change.showAssigneeSuggestOracle::
+
Allow assignee to be search-able through the changes search box.
If set to false, assignees search predicates will not be suggested
in the changes search box.
+
NOTE: When both showAssignee and showAssigneeSuggestOracle are both
set to false, the assignee field would not be shown anywhere in Gerrit,
disabling the access to the feature.
+
Default is true.
[[change.submitLabel]]change.submitLabel::
+
Label name for the submit button.

View File

@ -16,8 +16,7 @@ package com.google.gerrit.extensions.common;
public class ChangeConfigInfo {
public Boolean allowBlame;
public Boolean showAssignee;
public Boolean showAssigneeSuggestOracle;
public Boolean showAssigneeInChangesTable;
public Boolean allowDrafts;
public int largeChange;
public String replyLabel;

View File

@ -70,10 +70,7 @@ public class ServerInfo extends JavaScriptObject {
public final native String replyTooltip() /*-{ return this.reply_tooltip; }-*/;
public final native boolean showAssignee() /*-{ return this.show_assignee || false; }-*/;
public final native boolean
showAssigneeSuggestOracle() /*-{ return this.show_assignee_suggest_oracle || false; }-*/;
public final native boolean showAssigneeInChangesTable() /*-{ return this.show_assignee_in_changes_table || false; }-*/;
public final native int updateDelay() /*-{ return this.update_delay || 0; }-*/;

View File

@ -157,11 +157,9 @@ public class SearchSuggestOracle extends HighlightSuggestOracle {
suggestions.add("hashtag:");
}
if (Gerrit.info().change().showAssigneeSuggestOracle()) {
suggestions.add("is:assigned");
suggestions.add("is:unassigned");
suggestions.add("assignee:");
}
suggestions.add("is:assigned");
suggestions.add("is:unassigned");
suggestions.add("assignee:");
suggestions.add("AND");
suggestions.add("OR");

View File

@ -156,7 +156,6 @@ public class MyPreferencesScreen extends SettingsScreen {
dateTimePanel.add(timeFormat);
}
highlightAssigneeInChangeTable = new CheckBox(Util.C.highlightAssigneeInChangeTable());
highlightAssigneeInChangeTable.setEnabled(Gerrit.info().change().showAssignee());
relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable());
sizeBarInChangeTable = new CheckBox(Util.C.showSizeBarInChangeTable());
legacycidInChangeTable = new CheckBox(Util.C.showLegacycidInChangeTable());
@ -290,7 +289,7 @@ public class MyPreferencesScreen extends SettingsScreen {
maximumPageSize.setEnabled(on);
dateFormat.setEnabled(on);
timeFormat.setEnabled(on);
highlightAssigneeInChangeTable.setEnabled(Gerrit.info().change().showAssignee());
highlightAssigneeInChangeTable.setEnabled(on);
relativeDateInChangeTable.setEnabled(on);
sizeBarInChangeTable.setEnabled(on);
legacycidInChangeTable.setEnabled(on);

View File

@ -1324,12 +1324,7 @@ public class ChangeScreen extends Screen {
commit.set(commentLinkProcessor, info, revision);
related.set(info, revision);
reviewers.set(info);
if (Gerrit.info().change().showAssignee()
|| Gerrit.info().change().showAssigneeSuggestOracle()) {
assignee.set(info);
} else {
setVisible(assigneeRow, false);
}
assignee.set(info);
if (Gerrit.isNoteDbEnabled()) {
hashtags.set(info, revision);
} else {

View File

@ -80,7 +80,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
super(Util.C.changeItemHelp());
columns = BASE_COLUMNS;
labelNames = Collections.emptyList();
showAssignee = Gerrit.info().change().showAssignee();
showAssignee = Gerrit.info().change().showAssigneeInChangesTable();
showLegacyId = Gerrit.getUserPreferences().legacycidInChangeTable();
if (Gerrit.isSignedIn()) {

View File

@ -206,11 +206,8 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
info.allowDrafts = toBoolean(cfg.getBoolean("change", "allowDrafts", true));
boolean hasAssigneeInIndex =
indexes.getSearchIndex().getSchema().hasField(ChangeField.ASSIGNEE);
info.showAssignee =
toBoolean(cfg.getBoolean("change", "showAssignee", false) && hasAssigneeInIndex);
info.showAssigneeSuggestOracle =
toBoolean(
cfg.getBoolean("change", "showAssigneeSuggestOracle", true) && hasAssigneeInIndex);
info.showAssigneeInChangesTable =
toBoolean(cfg.getBoolean("change", "showAssigneeInChangesTable", false) && hasAssigneeInIndex);
info.largeChange = cfg.getInt("change", "largeChange", 500);
info.replyTooltip =
Optional.ofNullable(cfg.getString("change", null, "replyTooltip")).orElse("Reply and score")