Commit 3b2a909a authored by Tim Zallmann's avatar Tim Zallmann

Makes the html attribute in the json output optional with the option html_render=false

parent 20ca5e30
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
return Vue.http.get(endpoint, { params: { format: 'json' } }); return Vue.http.get(endpoint, { params: { format: 'json' } });
}, },
getFileData(endpoint) { getFileData(endpoint) {
return Vue.http.get(endpoint, { params: { format: 'json' } }); return Vue.http.get(endpoint, { params: { format: 'json', html_render: 'false' } });
}, },
getRawFileData(file) { getRawFileData(file) {
if (file.tempFile) { if (file.tempFile) {
......
...@@ -14,6 +14,8 @@ module RendersBlob ...@@ -14,6 +14,8 @@ module RendersBlob
return unless viewer return unless viewer
return {} if params[:html_render] == 'false'
{ {
html: view_to_html_string("projects/blob/_viewer", viewer: viewer, load_async: false) html: view_to_html_string("projects/blob/_viewer", viewer: viewer, load_async: false)
} }
......
...@@ -55,6 +55,24 @@ describe Projects::BlobController do ...@@ -55,6 +55,24 @@ describe Projects::BlobController do
expect(json_response).to have_key 'raw_path' expect(json_response).to have_key 'raw_path'
end end
end end
context "html_render=false" do
let(:id) { 'master/README.md' }
before do
get(:show,
namespace_id: project.namespace,
project_id: project,
id: id,
format: :json,
html_render: false)
end
it do
expect(response).to be_ok
expect(json_response).note_to have_key 'html'
end
end
end end
context 'with tree path' do context 'with tree path' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment