Hide assignee by default in Gerrit changes table

Keep backward-compatible behaviour for users coming
from Gerrit < 2.14 and not interested in the assignee
workflow.

The assignee feature will still be accessible through a second
configuration setting (showAssigneeSuggestOracle) that controls
the ability to suggest searching of the changes by assignee.

Typically people and organisations that want to use the
feature massively, will then enable it in the gerrit.config
to be more prevalent on the changes table.

When both showAssignee and showAssigneeSuggestOracle are
set to false, the feature is not accessible anymore because
you cannot neither see nor search for changes by assignee.

Change-Id: Ie826c126b5508c9013ee4f802f6bcfaff95cef76
This commit is contained in:
Luca Milanesio
2017-04-06 09:59:11 +01:00
parent 596fff00cc
commit 50057ff887
6 changed files with 26 additions and 6 deletions

View File

@@ -1024,8 +1024,20 @@ Default is true.
[[change.showAssignee]]change.showAssignee::
+
Allow assignee workflow. If set to false, assignees will not be visible anywhere
in UI.
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.

View File

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

View File

@@ -72,6 +72,9 @@ public class ServerInfo extends JavaScriptObject {
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 int updateDelay() /*-{ return this.update_delay || 0; }-*/;
public final native boolean isSubmitWholeTopicEnabled() /*-{

View File

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

View File

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

View File

@@ -204,10 +204,13 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
ChangeConfigInfo info = new ChangeConfigInfo();
info.allowBlame = toBoolean(cfg.getBoolean("change", "allowBlame", true));
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", "showAssignee", true)
&& indexes.getSearchIndex().getSchema().hasField(ChangeField.ASSIGNEE));
cfg.getBoolean("change", "showAssigneeSuggestOracle", true) && hasAssigneeInIndex);
info.largeChange = cfg.getInt("change", "largeChange", 500);
info.replyTooltip =
Optional.ofNullable(cfg.getString("change", null, "replyTooltip")).orElse("Reply and score")