[FIX] mail: fixes src for text files in the document viewer

Before this commit, the url for the src of the iFrame used
to display text files in the document viewer wasn't properly set,
resulting in the `model` argument to be invalid.

This commit fixes this issue.

Task-Id 2058588

closes odoo/odoo#36160

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Thanh Dodeur
2019-10-02 21:30:17 +00:00
committed by Alexandre Kühn
parent a5251e1d40
commit 7e0ed840d6
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -53,7 +53,7 @@
</div>
<img t-if="widget.activeAttachment.fileType === 'image'" class="o_viewer_img" t-attf-src="/web/image/#{widget.activeAttachment.id}?unique=1&amp;signature=#{widget.activeAttachment.checksum}&amp;model=#{model}" alt="Viewer"/>
<iframe t-if="widget.activeAttachment.fileType == 'application/pdf'" class="mt32 o_viewer_pdf" t-attf-src="/web/static/lib/pdfjs/web/viewer.html?file=/web/content/#{widget.activeAttachment.id}?model%3D#{model}" />
<iframe t-if="(widget.activeAttachment.fileType || '').indexOf('text') !== -1" class="mt32 o_viewer_text" t-attf-src="/web/content/#{widget.activeAttachment.id}?model%3D#{model}" />
<iframe t-if="(widget.activeAttachment.fileType || '').indexOf('text') !== -1" class="mt32 o_viewer_text" t-attf-src="/web/content/#{widget.activeAttachment.id}?model=#{model}" />
<iframe t-if="widget.activeAttachment.fileType == 'youtu'" class="mt32 o_viewer_text" allow="autoplay; encrypted-media" width="560" height="315" t-attf-src="https://www.youtube.com/embed/#{widget.activeAttachment.youtube}"/>
<video t-if="widget.activeAttachment.fileType == 'video'" class="o_viewer_video" controls="controls">
<source t-attf-src="/web/image/#{widget.activeAttachment.id}?model=#{model}" t-att-data-type="widget.activeAttachment.mimetype"/>
@@ -25,7 +25,7 @@ var createViewer = function (params) {
if (route === 'https://www.youtube.com/embed/FYqW0Gdwbzk') {
return Promise.resolve();
}
if (route === '/web/content/4?model%3Dir.attachment') {
if (route === '/web/content/4?model=ir.attachment') {
return Promise.resolve();
}
if (route === '/web/image/6?unique=1&signature=999&model=ir.attachment') {
@@ -134,7 +134,7 @@ QUnit.module('DocumentViewer', {
assert.strictEqual(viewer.$(".o_image_caption:contains('text.html')").length, 1,
"the viewer be on the right attachment");
assert.containsOnce(viewer, 'iframe[data-src="/web/content/4?model%3Dir.attachment"]',
assert.containsOnce(viewer, 'iframe[data-src="/web/content/4?model=ir.attachment"]',
"there should be an iframe with the right src");
viewer.destroy();