Configuration option change.showAssignee

Allows hiding of all assignee UI elements from users,
effectively disabling assignee workflow.

Change-Id: I29fecebcec6a09ab32ebc7f5ea78c1f739f3379a
This commit is contained in:
Gustaf Lundh
2016-09-19 14:41:29 +02:00
parent 9f60d584c8
commit 661d30a8c3
8 changed files with 43 additions and 15 deletions

View File

@@ -980,6 +980,13 @@ performance improvements by reducing the number of refs in the repo.
+
Default is true.
[[change.showAssignee]]change.showAssignee::
+
Allow assignee workflow. If set to false, assignees will not be visible anywhere
in UI.
+
Default is true.
[[change.submitLabel]]change.submitLabel::
+
Label name for the submit button.

View File

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

View File

@@ -59,6 +59,7 @@ public class ServerInfo extends JavaScriptObject {
public final native int largeChange() /*-{ return this.large_change || 0; }-*/;
public final native String replyLabel() /*-{ return this.reply_label; }-*/;
public final native String replyTooltip() /*-{ return this.reply_tooltip; }-*/;
public final native boolean showAssignee() /*-{ return this.show_assignee || false; }-*/;
public final native int updateDelay() /*-{ return this.update_delay || 0; }-*/;
public final native boolean isSubmitWholeTopicEnabled() /*-{
return this.submit_whole_topic; }-*/;

View File

@@ -120,8 +120,6 @@ public class SearchSuggestOracle extends HighlightSuggestOracle {
suggestions.add("is:merged");
suggestions.add("is:abandoned");
suggestions.add("is:mergeable");
suggestions.add("is:assigned");
suggestions.add("is:unassigned");
suggestions.add("status:");
suggestions.add("status:open");
@@ -141,7 +139,11 @@ public class SearchSuggestOracle extends HighlightSuggestOracle {
suggestions.add("hashtag:");
}
if (Gerrit.info().change().showAssignee()) {
suggestions.add("is:assigned");
suggestions.add("is:unassigned");
suggestions.add("assignee:");
}
suggestions.add("AND");
suggestions.add("OR");

View File

@@ -171,6 +171,7 @@ public class ChangeScreen extends Screen {
@UiField Anchor permalink;
@UiField Assignee assignee;
@UiField Element assigneeRow;
@UiField Element ccText;
@UiField Reviewers reviewers;
@UiField Hashtags hashtags;
@@ -1294,8 +1295,12 @@ public class ChangeScreen extends Screen {
topic.set(info, revision);
commit.set(commentLinkProcessor, info, revision);
related.set(info, revision);
assignee.set(info);
reviewers.set(info);
if (Gerrit.info().change().showAssignee()) {
assignee.set(info);
} else {
setVisible(assigneeRow, false);
}
if (Gerrit.isNoteDbEnabled()) {
hashtags.set(info, revision);
} else {

View File

@@ -463,7 +463,7 @@ limitations under the License.
</g:FlowPanel>
</td>
</tr>
<tr>
<tr ui:field='assigneeRow'>
<th><ui:msg>Assignee</ui:msg></th>
<td>
<c:Assignee ui:field='assignee'/>

View File

@@ -73,6 +73,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
private final List<Section> sections;
private int columns;
private final boolean showAssignee;
private final boolean showLegacyId;
private List<String> labelNames;
@@ -80,6 +81,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
super(Util.C.changeItemHelp());
columns = BASE_COLUMNS;
labelNames = Collections.emptyList();
showAssignee = Gerrit.info().change().showAssignee();
showLegacyId = Gerrit.getUserPreferences().legacycidInChangeTable();
if (Gerrit.isSignedIn()) {
@@ -106,6 +108,9 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
if (!showLegacyId) {
fmt.addStyleName(0, C_ID, Gerrit.RESOURCES.css().dataHeaderHidden());
}
if (!showAssignee) {
fmt.addStyleName(0, C_ASSIGNEE, Gerrit.RESOURCES.css().dataHeaderHidden());
}
table.addClickHandler(new ClickHandler() {
@Override
@@ -166,7 +171,9 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
fmt.addStyleName(row, C_SUBJECT, Gerrit.RESOURCES.css().cSUBJECT());
fmt.addStyleName(row, C_STATUS, Gerrit.RESOURCES.css().cSTATUS());
fmt.addStyleName(row, C_OWNER, Gerrit.RESOURCES.css().cOWNER());
fmt.addStyleName(row, C_ASSIGNEE, Gerrit.RESOURCES.css().cASSIGNEE());
fmt.addStyleName(row, C_ASSIGNEE,
showAssignee ? Gerrit.RESOURCES.css().cASSIGNEE()
: Gerrit.RESOURCES.css().dataCellHidden());
fmt.addStyleName(row, C_LAST_UPDATE, Gerrit.RESOURCES.css().cLastUpdate());
fmt.addStyleName(row, C_SIZE, Gerrit.RESOURCES.css().cSIZE());
@@ -242,6 +249,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
table.setText(row, C_OWNER, "");
}
if (showAssignee) {
if (c.assignee() != null) {
table.setWidget(row, C_ASSIGNEE,
AccountLinkPanel.forAssignee(c.assignee()));
@@ -253,6 +261,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
} else {
table.setText(row, C_ASSIGNEE, "");
}
}
table.setWidget(row, C_PROJECT, new ProjectLink(c.projectNameKey()));
table.setWidget(row, C_BRANCH, new BranchLink(c.projectNameKey(), c

View File

@@ -203,6 +203,9 @@ 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));
info.showAssignee =
toBoolean(cfg.getBoolean("change", "showAssignee", true)
&& isNoteDbEnabled());
info.largeChange = cfg.getInt("change", "largeChange", 500);
info.replyTooltip =
Optional.fromNullable(cfg.getString("change", null, "replyTooltip"))