Make "View as Document Type..." only show valid options

Summary:
Ref T13513. Currently, "View as Document Type..." lists every available engine.

This is hard to get completely right because we can't always rebuild the document ref accurately in the endpoint, but try harder to fake something reasonable.

Test Plan: Used "View as Document Type..." on Jupyter notebooks, was given "Jupyter" and "Source" as options.

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21241
This commit is contained in:
epriestley
2020-05-12 13:24:53 -07:00
parent 0cca40db3b
commit acc1fa1655
5 changed files with 66 additions and 27 deletions

View File

@@ -944,8 +944,12 @@ JX.install('DiffChangesetList', {
.setIcon('fa-file-image-o')
.setName(pht('View As Document Type...'))
.setHandler(function(e) {
var options = changeset.getAvailableDocumentEngineKeys() || [];
options = options.join(',');
var params = {
engine: changeset.getResponseDocumentEngineKey(),
options: options
};
new JX.Workflow('/services/viewas/', params)