Make submittable a ListChangesOption

Some scripts rely on the submittable bit from QueryChanges to
implement an 'automatically submit when approved to do so' feature,
to allow a person to mark a change as Autosubmit-Ready and go home
for the night in the expectation that a CI system will verify the
change and cause it to be submitted.

4cd05b2c5e (Only compute submittable
during submitted_together, 2016-09-17), which was needed for
performance reasons when rendering dashboards, broke these scripts.
Allow them to work again through a new o=SUBMITTABLE option.

Change-Id: Ia6ce6d95b1d774ede786b797eb04ce1353de6c86
This commit is contained in:
Jonathan Nieder
2016-09-23 11:37:57 -07:00
parent b21c20ba0e
commit cb51d7465a
5 changed files with 23 additions and 15 deletions

View File

@@ -54,7 +54,8 @@ public class SubmittedTogether implements RestReadView<ChangeResource> {
private final EnumSet<ListChangesOption> jsonOpt = EnumSet.of(
ListChangesOption.CURRENT_REVISION,
ListChangesOption.CURRENT_COMMIT);
ListChangesOption.CURRENT_COMMIT,
ListChangesOption.SUBMITTABLE);
private final ChangeJson.Factory json;
private final Provider<ReviewDb> dbProvider;
@@ -152,9 +153,7 @@ public class SubmittedTogether implements RestReadView<ChangeResource> {
}
SubmittedTogetherInfo info = new SubmittedTogetherInfo();
info.changes = json.create(jsonOpt)
.includeSubmittable(true)
.formatChangeDatas(cds);
info.changes = json.create(jsonOpt).formatChangeDatas(cds);
info.nonVisibleChanges = hidden;
return info;
} catch (OrmException | IOException e) {