diff options
| author | fja-odoo <fja@odoo.com> | 2019-07-25 08:20:59 +0000 |
|---|---|---|
| committer | fja-odoo <fja@odoo.com> | 2019-07-30 15:57:14 +0000 |
| commit | 2d6dc75a2cb5fa81189920d0f7fdc7b7f12132ab (patch) | |
| tree | 676231ee9b42ca9957936023ada029784889deec /addons/website_forum/static/src | |
| parent | caf6cb929b852209e84fa23efd10f58651d18d8e (diff) | |
[FIX] web, *: make crash_manager use services correctly
* = website_forum, stock
Fix for: https://github.com/odoo/odoo/pull/32132
crash_manager.js was using the services while bypassing
ServiceProviderMixin That means all services are duplicated, each having
their own state.
To fix this issue, CrashManager now extends AbstractService. Also
crash_manager is now registered in serviceRegistry instead of being
instanciated on the fly.
The crash_manager now being a Service raise one issue with the tests:
The services are not run for the tests but some tests needs the
crash_manager 'unhandledrejection' listener. For that matter the
services are reenable in qunit. Also the crash_manager's
'unhandledrejection' listener has to have precedence over the qunit
listener as it will handle rejections wich have no reason or are not
Errors.
Part of: https://github.com/odoo/odoo/pull/35209
Diffstat (limited to 'addons/website_forum/static/src')
| -rw-r--r-- | addons/website_forum/static/src/js/website_forum.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js index 9528a9b5e73..b364a3f9d1c 100644 --- a/addons/website_forum/static/src/js/website_forum.js +++ b/addons/website_forum/static/src/js/website_forum.js @@ -2,7 +2,6 @@ odoo.define('website_forum.website_forum', function (require) { 'use strict'; var core = require('web.core'); -var crash_manager = require('web.crash_manager'); var Wysiwyg = require('web_editor.wysiwyg.root'); var publicWidget = require('web.public.widget'); var session = require('web.session'); @@ -190,7 +189,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({ msg = _t("Sorry you must be logged in to perform this action"); title = _t("Access Denied"); } - crash_manager.show_warning({ + this.call('crash_manager', 'show_warning', { message: msg, title: title, }, { @@ -237,6 +236,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({ * @param {Event} ev */ _onFlagAlertClick: function (ev) { + var self = this; ev.preventDefault(); var $link = $(ev.currentTarget); this._rpc({ @@ -251,7 +251,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({ } else if (data.error === 'post_non_flaggable') { message = _t("This post can not be flagged"); } - crash_manager.show_warning({ + self.call('crash_manager', 'show_warning', { message: message, title: _t("Access Denied"), }, { @@ -278,6 +278,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({ * @param {Event} ev */ _onVotePostClick: function (ev) { + var self = this; ev.preventDefault(); var $link = $(ev.currentTarget); this._rpc({ @@ -290,7 +291,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({ } else if (data.error === 'anonymous_user') { message = _t('Sorry you must be logged to vote'); } - crash_manager.show_warning({ + self.call('crash_manager', 'show_warning', { message: message, title: _t("Access Denied"), }, { @@ -334,6 +335,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({ * @param {Event} ev */ _onAcceptAnswerClick: function (ev) { + var self = this; ev.preventDefault(); var $link = $(ev.currentTarget); this._rpc({ @@ -343,7 +345,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({ if (data.error === 'anonymous_user') { var message = _t("Sorry, anonymous users cannot choose correct answer."); } - crash_manager.show_warning({ + self.call('crash_manager', 'show_warning', { message: message, title: _t("Access Denied"), }, { |
