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. 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:: [[change.submitLabel]]change.submitLabel::
+ +
Label name for the submit button. Label name for the submit button.

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.extensions.common;
public class ChangeConfigInfo { public class ChangeConfigInfo {
public Boolean allowBlame; public Boolean allowBlame;
public Boolean showAssignee;
public Boolean allowDrafts; public Boolean allowDrafts;
public int largeChange; public int largeChange;
public String replyLabel; 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 int largeChange() /*-{ return this.large_change || 0; }-*/;
public final native String replyLabel() /*-{ return this.reply_label; }-*/; public final native String replyLabel() /*-{ return this.reply_label; }-*/;
public final native String replyTooltip() /*-{ return this.reply_tooltip; }-*/; 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 int updateDelay() /*-{ return this.update_delay || 0; }-*/;
public final native boolean isSubmitWholeTopicEnabled() /*-{ public final native boolean isSubmitWholeTopicEnabled() /*-{
return this.submit_whole_topic; }-*/; return this.submit_whole_topic; }-*/;

View File

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

View File

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

View File

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

View File

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

View File

@@ -203,6 +203,9 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
ChangeConfigInfo info = new ChangeConfigInfo(); ChangeConfigInfo info = new ChangeConfigInfo();
info.allowBlame = toBoolean(cfg.getBoolean("change", "allowBlame", true)); info.allowBlame = toBoolean(cfg.getBoolean("change", "allowBlame", true));
info.allowDrafts = toBoolean(cfg.getBoolean("change", "allowDrafts", 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.largeChange = cfg.getInt("change", "largeChange", 500);
info.replyTooltip = info.replyTooltip =
Optional.fromNullable(cfg.getString("change", null, "replyTooltip")) Optional.fromNullable(cfg.getString("change", null, "replyTooltip"))