Add privateByDefault config to /config/server/info

Exposing 'privateByDefault' there would be supper useful for polygerrit
when we are implementing the create change dialog.

Change-Id: I248210124a2d972934a94c42c32ccae39c0cfca3
This commit is contained in:
Paladox none 2017-08-04 12:04:53 +00:00
parent f9747f90a1
commit 6f494e3db9
4 changed files with 7 additions and 0 deletions

View File

@ -1473,6 +1473,9 @@ allowed].
|`large_change` ||
link:config-gerrit.html#change.largeChange[Number of changed lines from
which on a change is considered as a large change].
|`private_by_default` |not set if `false`|
Returns true if changes are by default created as private.
See link:config-gerrit.html#change.privateByDefault[privateByDefault]
|`reply_label` ||
link:config-gerrit.html#change.replyTooltip[Label name for the reply
button].

View File

@ -52,6 +52,7 @@ public class ServerInfoIT extends AbstractDaemonTest {
// change
@GerritConfig(name = "change.allowDrafts", value = "false")
@GerritConfig(name = "change.largeChange", value = "300")
@GerritConfig(name = "change.privateByDefault", value = "true")
@GerritConfig(name = "change.replyTooltip", value = "Publish votes and draft comments")
@GerritConfig(name = "change.replyLabel", value = "Vote")
@GerritConfig(name = "change.updateDelay", value = "50s")
@ -93,6 +94,7 @@ public class ServerInfoIT extends AbstractDaemonTest {
// change
assertThat(i.change.allowDrafts).isNull();
assertThat(i.change.largeChange).isEqualTo(300);
assertThat(i.change.privateByDefault).isTrue();
assertThat(i.change.replyTooltip).startsWith("Publish votes and draft comments");
assertThat(i.change.replyLabel).isEqualTo("Vote\u2026");
assertThat(i.change.updateDelay).isEqualTo(50);

View File

@ -19,6 +19,7 @@ public class ChangeConfigInfo {
public Boolean showAssigneeInChangesTable;
public Boolean allowDrafts;
public int largeChange;
public Boolean privateByDefault;
public String replyLabel;
public String replyTooltip;
public int updateDelay;

View File

@ -217,6 +217,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
toBoolean(
cfg.getBoolean("change", "showAssigneeInChangesTable", false) && hasAssigneeInIndex);
info.largeChange = cfg.getInt("change", "largeChange", 500);
info.privateByDefault = toBoolean(cfg.getBoolean("change", "privateByDefault", false));
info.replyTooltip =
Optional.ofNullable(cfg.getString("change", null, "replyTooltip")).orElse("Reply and score")
+ " (Shortcut: a)";