Merge "SubmittedTogether: Only show tab if there is more than one change"

This commit is contained in:
Shawn Pearce
2015-07-22 15:43:33 +00:00
committed by Gerrit Code Review
3 changed files with 59 additions and 13 deletions

View File

@@ -32,6 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
@@ -60,12 +61,16 @@ public class SubmittedTogether implements RestReadView<ChangeResource> {
try {
ChangeSet cs = mergeSuperSet.completeChangeSet(dbProvider.get(),
ChangeSet.create(resource.getChange()));
return json.create(EnumSet.of(
ListChangesOption.CURRENT_REVISION,
ListChangesOption.CURRENT_COMMIT,
ListChangesOption.DETAILED_LABELS,
ListChangesOption.LABELS))
.format(cs.ids());
if (cs.ids().size() > 1) {
return json.create(EnumSet.of(
ListChangesOption.CURRENT_REVISION,
ListChangesOption.CURRENT_COMMIT,
ListChangesOption.DETAILED_LABELS,
ListChangesOption.LABELS))
.format(cs.ids());
} else {
return Collections.emptyList();
}
} catch (OrmException | IOException e) {
log.error("Error on getting a ChangeSet", e);
throw e;