diff options
| author | Siddarth Gajjar <sga@odoo.com> | 2020-06-12 08:47:39 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-10-07 10:26:20 +0000 |
| commit | c1b8c1d811adc215ae5671e51d2e03cf2c1699f6 (patch) | |
| tree | 9677e01b8618f2cec88fe544311fe39948d0665e /addons/website_slides | |
| parent | 536809662e542994451be793cd09e87adbf31776 (diff) | |
[FIX] website_slides: fix concurrency traceback
- Prior to this commit, slide content of type document or presentation is
having src as '/slides/embed' and that controller tries to set slide as
viewed. Along with this, for few slide types (including document and
presentation) and for logged in user, it will try to set slide as completed
once slide rendering is done with help of method `_setCompleted`, without
waiting for the iframe to be loaded. This means, the controller called from
the src of iFrame and the above method both tries to update same 'slide_slide'
table at the same time, resulting into concurrency error.
- This commit fixes the issue by marking the slide as completed (with help
of method `_setCompleted`) only after the iFrame is loaded, avoiding the
concurrent updation of 'slide.slide' table.
TaskID 2265863
Closes https://github.com/odoo/odoo/pull/52918
closes odoo/odoo#59382
X-original-commit: c5f406c8cbf43c56939cee054f9b911fe3933b3b
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/website_slides')
| -rw-r--r-- | addons/website_slides/static/src/js/slides_course_fullscreen_player.js | 7 | ||||
| -rw-r--r-- | addons/website_slides/static/src/tests/tours/slides_course_member.js | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/addons/website_slides/static/src/js/slides_course_fullscreen_player.js b/addons/website_slides/static/src/js/slides_course_fullscreen_player.js index a8a136c8e0a..85e0f5b1860 100644 --- a/addons/website_slides/static/src/js/slides_course_fullscreen_player.js +++ b/addons/website_slides/static/src/js/slides_course_fullscreen_player.js @@ -634,7 +634,12 @@ odoo.define('website_slides.fullscreen', function (require) { return self._renderSlide(); }).then(function() { if (slide._autoSetDone && !session.is_website_user) { // no useless RPC call - return self._setCompleted(slide.id); + if (['document', 'presentation'].includes(slide.type)) { + // only set the slide as completed after iFrame is loaded to avoid concurrent execution with 'embedUrl' controller + self.el.querySelector('iframe.o_wslides_iframe_viewer').addEventListener('load', () => self._setCompleted(slide.id)); + } else { + return self._setCompleted(slide.id); + } } }); }, diff --git a/addons/website_slides/static/src/tests/tours/slides_course_member.js b/addons/website_slides/static/src/tests/tours/slides_course_member.js index 8a7e3076a87..7f30b9456a7 100644 --- a/addons/website_slides/static/src/tests/tours/slides_course_member.js +++ b/addons/website_slides/static/src/tests/tours/slides_course_member.js @@ -47,7 +47,7 @@ tour.register('course_member', { } }, { trigger: '.o_wslides_fs_sidebar_header.navigation-success-1', - extra_trigger: '.o_wslides_progress_percentage:contains("20")', + extra_trigger: '.o_wslides_progress_percentage:contains("40")', run: function () { // check navigation with arrow keys var event = jQuery.Event("keydown"); |
