summaryrefslogtreecommitdiff
path: root/addons/mail/static
diff options
context:
space:
mode:
authorThanh Dodeur <tso@odoo.com>2020-03-26 09:11:30 +0000
committerThanh Dodeur <tso@odoo.com>2020-04-17 11:09:41 +0000
commitbf97152ce99f84a524ed8773280b4bba8fca38da (patch)
tree5776a716c2bdcd06a89170511793a838b860f662 /addons/mail/static
parenta6e96c256ded6bb764d1ab469878ef780ecdbe3c (diff)
[REF] mail: removes signature from route params
This commit removes the unnecessary usage of `signature` instead of `unique` in the route params for `web/image`. closes odoo/odoo#48437 Related: odoo/enterprise#9501 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/mail/static')
-rw-r--r--addons/mail/static/src/xml/thread.xml11
-rw-r--r--addons/mail/static/tests/chatter_tests.js10
-rw-r--r--addons/mail/static/tests/document_viewer_tests.js6
3 files changed, 15 insertions, 12 deletions
diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml
index b32b8afa1af..0774be1ccaa 100644
--- a/addons/mail/static/src/xml/thread.xml
+++ b/addons/mail/static/src/xml/thread.xml
@@ -54,10 +54,13 @@
</div>
<div class="o_viewer_img_wrapper">
<div class="o_viewer_zoomer">
- <div t-if="widget.activeAttachment.fileType == 'image'" class="o_loading_img text-center">
- <i class="fa fa-circle-o-notch fa-spin text-gray-light fa-3x fa-fw" role="img" aria-label="Loading" title="Loading"/>
- </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"/>
+ <t t-if="widget.activeAttachment.fileType === 'image'">
+ <div class="o_loading_img text-center">
+ <i class="fa fa-circle-o-notch fa-spin text-gray-light fa-3x fa-fw" role="img" aria-label="Loading" title="Loading"/>
+ </div>
+ <t t-set="unique" t-value="widget.activeAttachment.checksum ? widget.activeAttachment.checksum.slice(-8) : ''"/>
+ <img class="o_viewer_img" t-attf-src="/web/image/#{widget.activeAttachment.id}?unique=#{unique}&amp;model=#{model}" alt="Viewer"/>
+ </t>
<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=#{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}"/>
diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js
index c3cb823738a..8e7ea9beb9d 100644
--- a/addons/mail/static/tests/chatter_tests.js
+++ b/addons/mail/static/tests/chatter_tests.js
@@ -1775,21 +1775,21 @@ QUnit.test('chatter: Attachment viewer', async function (assert) {
attachment_ids: [{
filename: 'image1.jpg',
id:1,
- checksum: 999,
+ checksum: '123456789abc',
mimetype: 'image/jpeg',
name: 'Test Image 1',
url: '/web/content/1?download=true'
},{
filename: 'image2.jpg',
id:2,
- checksum: 999,
+ checksum: '123456789abc',
mimetype: 'image/jpeg',
name: 'Test Image 2',
url: '/web/content/2?download=true'
},{
filename: 'image3.jpg',
id:3,
- checksum: 999,
+ checksum: '123456789abc',
mimetype: 'image/jpeg',
name: 'Test Image 3',
url: '/web/content/3?download=true'
@@ -1840,11 +1840,11 @@ QUnit.test('chatter: Attachment viewer', async function (assert) {
"image caption should have correct download link");
// click on first image attachement
await testUtils.dom.click(form.$('.o_thread_message .o_attachment .o_image_box .o_image_overlay').first());
- assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/1?unique=1&signature=999&model=ir.attachment"]').length, 1,
+ assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/1?unique=56789abc&model=ir.attachment"]').length, 1,
"Modal popup should open with first image src");
// click on next button
await testUtils.dom.click($('.modal .arrow.arrow-right.move_next span'));
- assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/2?unique=1&signature=999&model=ir.attachment"]').length, 1,
+ assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/2?unique=56789abc&model=ir.attachment"]').length, 1,
"Modal popup should have now second image src");
assert.strictEqual($('.o_modal_fullscreen .o_viewer_toolbar .o_download_btn').length, 1,
"Modal popup should have download button");
diff --git a/addons/mail/static/tests/document_viewer_tests.js b/addons/mail/static/tests/document_viewer_tests.js
index 4d914347669..5ccb9df5ff3 100644
--- a/addons/mail/static/tests/document_viewer_tests.js
+++ b/addons/mail/static/tests/document_viewer_tests.js
@@ -28,7 +28,7 @@ var createViewer = function (params) {
if (route === '/web/content/4?model=ir.attachment') {
return Promise.resolve();
}
- if (route === '/web/image/6?unique=1&signature=999&model=ir.attachment') {
+ if (route === '/web/image/6?unique=56789abc&model=ir.attachment') {
return Promise.resolve();
}
};
@@ -70,7 +70,7 @@ QUnit.module('DocumentViewer', {
{id: 3, name: 'urlRandom', type: 'url', mimetype: '', url: 'https://www.google.com'},
{id: 4, name: 'text.html', type: 'binary', mimetype: 'text/html', datas:'testee'},
{id: 5, name: 'video.mp4', type: 'binary', mimetype: 'video/mp4', datas:'R0lDOP////ywAADs='},
- {id: 6, name: 'image.jpg', type: 'binary', mimetype: 'image/jpeg', checksum: 999, datas:'R0lVOP////ywAADs='},
+ {id: 6, name: 'image.jpg', type: 'binary', mimetype: 'image/jpeg', checksum: '123456789abc', datas:'R0lVOP////ywAADs='},
];
},
}, function () {
@@ -166,7 +166,7 @@ QUnit.module('DocumentViewer', {
assert.strictEqual(viewer.$(".o_image_caption:contains('image.jpg')").length, 1,
"the viewer be on the right attachment");
- assert.containsOnce(viewer, 'img[data-src="/web/image/6?unique=1&signature=999&model=ir.attachment"]',
+ assert.containsOnce(viewer, 'img[data-src="/web/image/6?unique=56789abc&model=ir.attachment"]',
"there should be a video player");
viewer.destroy();