ChangeScreen: reword submit button for single change topics

When `change.submitWholeTopic` is enabled and a topic is set for a change,
we always rendered the submit button with "Submit whole topic". This is
confusing when having only one change in the topic, which can easily happen
when a user wants to revert just one change which was merged as part of a
larger topic before. Then the revert commit keeps the topic, but it's just
one change in the topic.

To avoid user confusion when having just one change in the topic, do not
display it as a submission of the whole topic, but rather treat it as a
change without topic.

The change for one change in a topic has been adapted to reflect the new
behavior. This does not worsen the test situation as there are still
	revisionActionsTwoChangeChangesInTopic
	revisionActionsTwoChangeChangesInTopicReady
which test the point of having the whole topic enabled.

Change-Id: Ic97400a05749d9db4a03eb512a52c84f43403a83
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/ActionsIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/ActionsIT.java
index afcd5d0..fac87b7 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/ActionsIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/ActionsIT.java
@@ -53,15 +53,9 @@
     approve(changeId);
     Map<String, ActionInfo> actions = getActions(changeId);
     commonActionsAssertions(actions);
-    if (isSubmitWholeTopicEnabled()) {
-      ActionInfo info = actions.get("submit");
-      assertThat(info.enabled).isTrue();
-      assertThat(info.label).isEqualTo("Submit whole topic");
-      assertThat(info.method).isEqualTo("POST");
-      assertThat(info.title).isEqualTo("Submit all 1 changes of the same topic");
-    } else {
-      noSubmitWholeTopicAssertions(actions);
-    }
+    // We want to treat a single change in a topic not as a whole topic,
+    // so regardless of how submitWholeTopic is configured:
+    noSubmitWholeTopicAssertions(actions);
   }
 
   @Test
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java
index 03bc7f1..96783b9 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java
@@ -290,13 +290,13 @@
         .setTitle("")
         .setVisible(false);
     }
+    List<ChangeData> changesByTopic = null;
     if (submitWholeTopic && !Strings.isNullOrEmpty(topic)) {
-      List<ChangeData> changesByTopic = null;
-      try {
-        changesByTopic = queryProvider.get().byTopicOpen(topic);
-      } catch (OrmException e) {
-        throw new OrmRuntimeException(e);
-      }
+      changesByTopic = getChangesByTopic(topic);
+    }
+    if (submitWholeTopic
+        && !Strings.isNullOrEmpty(topic)
+        && changesByTopic.size() > 1) {
       Map<String, String> params = ImmutableMap.of(
           "topicSize", String.valueOf(changesByTopic.size()));
       String topicProblems = problemsForSubmittingChanges(changesByTopic,
@@ -665,6 +665,14 @@
     return config.getBoolean("change", null, "submitWholeTopic" , false);
   }
 
+  private List<ChangeData> getChangesByTopic(String topic) {
+    try {
+      return queryProvider.get().byTopicOpen(topic);
+    } catch (OrmException e) {
+      throw new OrmRuntimeException(e);
+    }
+  }
+
   public static class CurrentRevision implements
       RestModifyView<ChangeResource, SubmitInput> {
     private final Provider<ReviewDb> dbProvider;