summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanh Dodeur <tso@odoo.com>2019-08-28 07:48:57 +0000
committerAlexandre Kühn <aku@odoo.com>2019-10-02 21:30:17 +0000
commit7e0ed840d6a17f050a3c99e8286a8124eaf8a4dc (patch)
tree9936403ad2c76a362170037ddd8d45978c01df25
parenta5251e1d40d9bd833993bf1618fc2760adb6567a (diff)
[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>
-rw-r--r--addons/mail/static/src/xml/thread.xml2
-rw-r--r--addons/mail/static/tests/document_viewer_tests.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml
index 50eea76a406..24370c65e4e 100644
--- a/addons/mail/static/src/xml/thread.xml
+++ b/addons/mail/static/src/xml/thread.xml
@@ -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"/>
diff --git a/addons/mail/static/tests/document_viewer_tests.js b/addons/mail/static/tests/document_viewer_tests.js
index 404a6f267aa..4d914347669 100644
--- a/addons/mail/static/tests/document_viewer_tests.js
+++ b/addons/mail/static/tests/document_viewer_tests.js
@@ -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();