[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>
This commit is contained in:
@@ -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&signature=#{widget.activeAttachment.checksum}&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}&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}"/>
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user