Set submitWholeTopic field in ServerInfo only if it is not false

This is consistent with how the other boolean fields are treated.

Also add tests for this field.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ib8afe7ec64a37f540ff59d73c7e6c4e9bc6d9aad
This commit is contained in:
Edwin Kempin
2019-08-23 10:36:57 +02:00
parent 181eed25f4
commit 3450ddecdc
3 changed files with 10 additions and 2 deletions

View File

@@ -1545,7 +1545,7 @@ button].
|`update_delay` ||
link:config-gerrit.html#change.updateDelay[How often in seconds the web
interface should poll for updates to the currently open change].
|`submit_whole_topic` ||
|`submit_whole_topic` |not set if `false`|
link:config-gerrit.html#change.submitWholeTopic[A configuration if
the whole topic is submitted].
|`disable_private_changes` |not set if `false`|

View File

@@ -234,7 +234,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
+ "\u2026";
info.updateDelay =
(int) ConfigUtil.getTimeUnit(config, "change", null, "updateDelay", 300, TimeUnit.SECONDS);
info.submitWholeTopic = MergeSuperSet.wholeTopicEnabled(config);
info.submitWholeTopic = toBoolean(MergeSuperSet.wholeTopicEnabled(config));
info.excludeMergeableInChangeInfo =
toBoolean(this.config.getBoolean("change", "api", "excludeMergeableInChangeInfo", false));
info.disablePrivateChanges =

View File

@@ -168,6 +168,7 @@ public class ServerInfoIT extends AbstractDaemonTest {
assertThat(i.change.replyLabel).isEqualTo("Reply\u2026");
assertThat(i.change.updateDelay).isEqualTo(300);
assertThat(i.change.disablePrivateChanges).isNull();
assertThat(i.change.submitWholeTopic).isNull();
assertThat(i.change.excludeMergeableInChangeInfo).isNull();
// download
@@ -192,6 +193,13 @@ public class ServerInfoIT extends AbstractDaemonTest {
assertThat(i.user.anonymousCowardName).isEqualTo(AnonymousCowardNameProvider.DEFAULT);
}
@Test
@GerritConfig(name = "change.submitWholeTopic", value = "true")
public void serverConfigWithSubmitWholeTopic() throws Exception {
ServerInfo i = gApi.config().server().getInfo();
assertThat(i.change.submitWholeTopic).isTrue();
}
@Test
@GerritConfig(name = "change.api.excludeMergeableInChangeInfo", value = "true")
public void serverConfigWithExcludeMergeableInChangeInfo() throws Exception {