diff options
| author | Didier (did) <did@odoo.com> | 2020-08-26 12:13:02 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-08-26 12:47:12 +0000 |
| commit | bde23b82029507e525cf55d11b050af5f820a06b (patch) | |
| tree | 419ca10b98197553ed7283a19b0c35cb672b4a66 /addons/mail_bot | |
| parent | 2e783a68b544515258af077e1cc63402f5b7f9c8 (diff) | |
[IMP] mail, mail_bot: move notif request and OdooBot name into mail
task-2282334
closes odoo/odoo#56584
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail_bot')
20 files changed, 1 insertions, 771 deletions
diff --git a/addons/mail_bot/__manifest__.py b/addons/mail_bot/__manifest__.py index 5168c906afd..1903553314e 100644 --- a/addons/mail_bot/__manifest__.py +++ b/addons/mail_bot/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'OdooBot', - 'version': '1.1', + 'version': '1.2', 'category': 'Productivity/Discuss', 'summary': 'Add OdooBot in discussions', 'description': "", @@ -21,9 +21,5 @@ ], 'qweb': [ 'static/src/bugfix/bugfix.xml', - 'static/src/components/messaging_menu/messaging_menu.xml', - 'static/src/components/notification_alert/notification_alert.xml', - 'static/src/components/notification_list/notification_list.xml', - 'static/src/components/notification_request/notification_request.xml', ], } diff --git a/addons/mail_bot/data/mailbot_data.xml b/addons/mail_bot/data/mailbot_data.xml index 4dbec8cf6c3..439a7e29ec0 100644 --- a/addons/mail_bot/data/mailbot_data.xml +++ b/addons/mail_bot/data/mailbot_data.xml @@ -1,12 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> <data> - <record id="base.partner_root" model="res.partner"> - <field name="name">OdooBot</field> - <field name="email">odoobot@example.com</field> - <field name="image_1920" type="base64" file="mail/static/src/img/odoobot.png"/> - </record> - <record id="base.user_root" model="res.users"> <field name="odoobot_state">disabled</field> </record> diff --git a/addons/mail_bot/models/__init__.py b/addons/mail_bot/models/__init__.py index 82aa165ecaf..709b1f93a09 100644 --- a/addons/mail_bot/models/__init__.py +++ b/addons/mail_bot/models/__init__.py @@ -5,5 +5,4 @@ from . import ir_http from . import mail_bot from . import mail_channel from . import mail_thread -from . import res_partner from . import res_users diff --git a/addons/mail_bot/models/res_partner.py b/addons/mail_bot/models/res_partner.py deleted file mode 100644 index 8a3fc3ca106..00000000000 --- a/addons/mail_bot/models/res_partner.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, models - - -class Partner(models.Model): - _inherit = 'res.partner' - - def _compute_im_status(self): - #we asume that mail_bot _compute_im_status will be executed after bus _compute_im_status - super(Partner, self)._compute_im_status() - odoobot_id = self.env['ir.model.data'].xmlid_to_res_id("base.partner_root") - for partner in self: - if partner.id == odoobot_id: - partner.im_status = 'bot' - - @api.model - def get_mention_suggestions(self, search, limit=8): - #add odoobot in mention suggestion when pinging in mail_thread - [users, partners] = super(Partner, self).get_mention_suggestions(search, limit=limit) - if len(partners) + len(users) < limit and "odoobot".startswith(search.lower()): - odoobot = self.env.ref("base.partner_root") - if odoobot and not any(elem['id'] == odoobot.id for elem in partners): - partners.append({'id': odoobot.id, 'name': odoobot.name, 'email': odoobot.email}) - return [users, partners] - diff --git a/addons/mail_bot/static/src/components/messaging_menu/messaging_menu.js b/addons/mail_bot/static/src/components/messaging_menu/messaging_menu.js deleted file mode 100644 index c1deec24095..00000000000 --- a/addons/mail_bot/static/src/components/messaging_menu/messaging_menu.js +++ /dev/null @@ -1,27 +0,0 @@ -odoo.define('mail_bot/static/src/components/messaging_menu/messaging_menu,js', function (require) { -'use strict'; - -const components = { - MessagingMenu: require('mail/static/src/components/messaging_menu/messaging_menu.js'), -}; - -const { patch } = require('web.utils'); - -patch(components.MessagingMenu, 'mail_bot/static/src/components/messaging_menu/messaging_menu,js', { - - //-------------------------------------------------------------------------- - // Handlers - //-------------------------------------------------------------------------- - - /** - * @private - */ - _onOdoobotRequestClicked() { - const device = this.messagingMenu.messaging.device; - if (!device.isMobile) { - this.messagingMenu.close(); - } - }, -}); - -}); diff --git a/addons/mail_bot/static/src/components/messaging_menu/messaging_menu.xml b/addons/mail_bot/static/src/components/messaging_menu/messaging_menu.xml deleted file mode 100644 index a6eb2cf2cd9..00000000000 --- a/addons/mail_bot/static/src/components/messaging_menu/messaging_menu.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<templates xml:space="preserve"> - <t t-inherit="mail.MessagingMenu" t-inherit-mode="extension"> - <xpath expr="//NotificationList" position="attributes"> - <attribute name="t-on-o-odoobot-request-clicked" t-translation="off">_onOdoobotRequestClicked</attribute> - </xpath> - </t> -</templates> diff --git a/addons/mail_bot/static/src/components/messaging_menu/messaging_menu_tests.js b/addons/mail_bot/static/src/components/messaging_menu/messaging_menu_tests.js deleted file mode 100644 index 98cd47a8932..00000000000 --- a/addons/mail_bot/static/src/components/messaging_menu/messaging_menu_tests.js +++ /dev/null @@ -1,175 +0,0 @@ -odoo.define('mail_bot/static/src/components/messaging_menu/messaging_menu_tests.js', function (require) { -"use strict"; - -const { - afterEach, - afterNextRender, - beforeEach, - start, -} = require('mail/static/src/utils/test_utils.js'); - -QUnit.module('mail_bot', {}, function () { -QUnit.module('components', {}, function () { -QUnit.module('messaging_menu', {}, function () { -QUnit.module('messaging_menu_tests.js', { - beforeEach() { - beforeEach(this); - - this.start = async params => { - let { widget } = await start(Object.assign({}, params, { - data: this.data, - hasMessagingMenu: true, - })); - this.widget = widget; - }; - }, - afterEach() { - afterEach(this); - }, -}); - -QUnit.test('rendering with OdooBot has a request (default)', async function (assert) { - assert.expect(4); - - await this.start({ - env: { - browser: { - Notification: { - permission: 'default', - }, - }, - }, - }); - - assert.ok( - document.querySelector('.o_MessagingMenu_counter'), - "should display a notification counter next to the messaging menu for OdooBot request" - ); - assert.strictEqual( - document.querySelector('.o_MessagingMenu_counter').textContent, - "1", - "should display a counter of '1' next to the messaging menu" - ); - - await afterNextRender(() => - document.querySelector('.o_MessagingMenu_toggler').click() - ); - assert.containsOnce( - document.body, - '.o_NotificationRequest', - "should display a notification in the messaging menu" - ); - assert.strictEqual( - document.querySelector('.o_NotificationRequest_name').textContent.trim(), - 'OdooBot has a request', - "notification should display that OdooBot has a request" - ); -}); - -QUnit.test('rendering without OdooBot has a request (denied)', async function (assert) { - assert.expect(2); - - await this.start({ - env: { - browser: { - Notification: { - permission: 'denied', - }, - }, - }, - }); - - assert.containsNone( - document.body, - '.o_MessagingMenu_counter', - "should not display a notification counter next to the messaging menu" - ); - - await afterNextRender(() => - document.querySelector('.o_MessagingMenu_toggler').click() - ); - assert.containsNone( - document.body, - '.o_NotificationRequest', - "should display no notification in the messaging menu" - ); -}); - -QUnit.test('rendering without OdooBot has a request (accepted)', async function (assert) { - assert.expect(2); - - await this.start({ - env: { - browser: { - Notification: { - permission: 'granted', - }, - }, - }, - }); - - assert.containsNone( - document.body, - '.o_MessagingMenu_counter', - "should not display a notification counter next to the messaging menu" - ); - - await afterNextRender(() => - document.querySelector('.o_MessagingMenu_toggler').click() - ); - assert.containsNone( - document.body, - '.o_NotificationRequest', - "should display no notification in the messaging menu" - ); -}); - -QUnit.test('respond to notification prompt (denied)', async function (assert) { - assert.expect(3); - - await this.start({ - env: { - browser: { - Notification: { - permission: 'default', - async requestPermission() { - this.permission = 'denied'; - return this.permission; - }, - }, - }, - }, - }); - - await afterNextRender(() => - document.querySelector('.o_MessagingMenu_toggler').click() - ); - await afterNextRender(() => - document.querySelector('.o_NotificationRequest').click() - ); - assert.containsOnce( - document.body, - '.toast .o_notification_content', - "should display a toast notification with the deny confirmation" - ); - assert.containsNone( - document.body, - '.o_MessagingMenu_counter', - "should not display a notification counter next to the messaging menu" - ); - - await afterNextRender(() => - document.querySelector('.o_MessagingMenu_toggler').click() - ); - assert.containsNone( - document.body, - '.o_NotificationRequest', - "should display no notification in the messaging menu" - ); -}); - -}); -}); -}); - -}); diff --git a/addons/mail_bot/static/src/components/notification_alert/notification_alert.js b/addons/mail_bot/static/src/components/notification_alert/notification_alert.js deleted file mode 100644 index 4cfcbc362a8..00000000000 --- a/addons/mail_bot/static/src/components/notification_alert/notification_alert.js +++ /dev/null @@ -1,52 +0,0 @@ -odoo.define('mail_bot/static/src/components/notification_alert/notification_alert.js', function (require) { -'use strict'; - -const useStore = require('mail/static/src/component_hooks/use_store/use_store.js'); - -const { Component } = owl; - -class NotificationAlert extends Component { - - /** - * @override - */ - constructor(...args) { - super(...args); - useStore(props => { - const isMessagingInitialized = this.env.isMessagingInitialized(); - return { - isMessagingInitialized, - isNotificationBlocked: this.isNotificationBlocked, - }; - }); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - /** - * @returns {boolean} - */ - get isNotificationBlocked() { - if (!this.env.isMessagingInitialized()) { - return false; - } - const windowNotification = this.env.browser.Notification; - return ( - windowNotification && - windowNotification.permission !== "granted" && - !this.env.messaging.isNotificationPermissionDefault() - ); - } - -} - -Object.assign(NotificationAlert, { - props: {}, - template: 'mail_bot.NotificationAlert', -}); - -return NotificationAlert; - -}); diff --git a/addons/mail_bot/static/src/components/notification_alert/notification_alert.xml b/addons/mail_bot/static/src/components/notification_alert/notification_alert.xml deleted file mode 100644 index e9b3eef9331..00000000000 --- a/addons/mail_bot/static/src/components/notification_alert/notification_alert.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<templates xml:space="preserve"> - - <t t-name="mail_bot.NotificationAlert" owl="1"> - <div class="o_NotificationAlert"> - <t t-if="env.isMessagingInitialized()"> - <center t-if="isNotificationBlocked" class="o_notification_alert alert alert-primary"> - Odoo Push notifications have been blocked. Go to your browser settings to allow them. - </center> - </t> - </div> - </t> - -</templates> diff --git a/addons/mail_bot/static/src/components/notification_list/notification_list.js b/addons/mail_bot/static/src/components/notification_list/notification_list.js deleted file mode 100644 index c0fa47930c9..00000000000 --- a/addons/mail_bot/static/src/components/notification_list/notification_list.js +++ /dev/null @@ -1,44 +0,0 @@ -odoo.define('mail_bot/static/src/components/notification_list/notification_list.js', function (require) { -'use strict'; - -const components = { - mail: { - NotificationList: require('mail/static/src/components/notification_list/notification_list.js'), - }, - mail_bot: { - NotificationRequest: require('mail_bot/static/src/components/notification_request/notification_request.js'), - }, -}; - -const { patch } = require('web.utils'); - -Object.assign(components.mail.NotificationList.components, components.mail_bot); - -patch(components.mail.NotificationList, 'mail_bot/static/src/components/notification_list/notification_list.js', { - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - - /** - * Override so that 'OdooBot has a request' is included at the top of the - * list. - * - * @override - */ - _useStoreSelector(props) { - const res = this._super(...arguments); - if ( - props.filter === 'all' && - this.env.messaging.isNotificationPermissionDefault() - ) { - res.notifications.unshift({ - type: 'odoobotRequest', - uniqueId: `odoobotRequest`, - }); - } - return res; - } -}); - -}); diff --git a/addons/mail_bot/static/src/components/notification_list/notification_list.xml b/addons/mail_bot/static/src/components/notification_list/notification_list.xml deleted file mode 100644 index da2a28ee090..00000000000 --- a/addons/mail_bot/static/src/components/notification_list/notification_list.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<templates xml:space="preserve"> - <t t-inherit="mail.NotificationList" t-inherit-mode="extension"> - <xpath expr="//*[@name='separatorCondition']" position="before"> - <t t-if="notification.type === 'odoobotRequest'"> - <NotificationRequest - class="o_NotificationList_notificationRequest" - t-att-class="{ 'o-mobile': env.messaging.device.isMobile }" - /> - </t> - </xpath> - </t> -</templates> diff --git a/addons/mail_bot/static/src/components/notification_request/notification_request.js b/addons/mail_bot/static/src/components/notification_request/notification_request.js deleted file mode 100644 index ef9639c688b..00000000000 --- a/addons/mail_bot/static/src/components/notification_request/notification_request.js +++ /dev/null @@ -1,90 +0,0 @@ -odoo.define('mail_bot/static/src/components/notification_request/notification_request.js', function (require) { -'use strict'; - -const components = { - PartnerImStatusIcon: require('mail/static/src/components/partner_im_status_icon/partner_im_status_icon.js'), -}; -const useStore = require('mail/static/src/component_hooks/use_store/use_store.js'); - -const { Component } = owl; - -class NotificationRequest extends Component { - - /** - * @override - */ - constructor(...args) { - super(...args); - useStore(props => { - return { - isDeviceMobile: this.env.messaging.device.isMobile, - partnerRoot: this.env.messaging.partnerRoot - ? this.env.messaging.partnerRoot.__state - : undefined, - }; - }); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - /** - * @returns {string} - */ - getHeaderText() { - return _.str.sprintf( - this.env._t("%s has a request"), - this.env.messaging.partnerRoot.nameOrDisplayName - ); - } - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - - /** - * Handle the response of the user when prompted whether push notifications - * are granted or denied. - * - * @private - * @param {string} value - */ - _handleResponseNotificationPermission(value) { - // manually force recompute because the permission is not in the store - this.env.messaging.messagingMenu.update(); - if (value !== 'granted') { - this.env.services['bus_service'].sendNotification( - this.env._t("Permission denied"), - this.env._t("Odoo will not have the permission to send native notifications on this device.") - ); - } - } - - //-------------------------------------------------------------------------- - // Handlers - //-------------------------------------------------------------------------- - - /** - * @private - */ - _onClick() { - const windowNotification = this.env.browser.Notification; - const def = windowNotification && windowNotification.requestPermission(); - if (def) { - def.then(this._handleResponseNotificationPermission.bind(this)); - } - this.trigger('o-odoobot-request-clicked'); - } - -} - -Object.assign(NotificationRequest, { - components, - props: {}, - template: 'mail_bot.NotificationRequest', -}); - -return NotificationRequest; - -}); diff --git a/addons/mail_bot/static/src/components/notification_request/notification_request.scss b/addons/mail_bot/static/src/components/notification_request/notification_request.scss deleted file mode 100644 index 8d4b38db848..00000000000 --- a/addons/mail_bot/static/src/components/notification_request/notification_request.scss +++ /dev/null @@ -1,73 +0,0 @@ -// ------------------------------------------------------------------ -// Layout -// ------------------------------------------------------------------ - -.o_NotificationRequest { - @include o-mail-notification-list-item-layout(); -} - -.o_NotificationRequest_content { - @include o-mail-notification-list-item-content-layout(); -} - -.o_NotificationRequest_core { - @include o-mail-notification-list-item-core-layout(); -} - -.o_NotificationRequest_coreItem { - @include o-mail-notification-list-item-core-item-layout(); -} - -.o_NotificationRequest_header { - @include o-mail-notification-list-item-header-layout(); -} - -.o_NotificationRequest_image { - @include o-mail-notification-list-item-image-layout(); -} - -.o_NotificationRequest_imageContainer { - @include o-mail-notification-list-item-image-container-layout(); -} - -.o_NotificationRequest_inlineText { - @include o-mail-notification-list-item-inline-text-layout(); -} - -.o_NotificationRequest_name { - @include o-mail-notification-list-item-name-layout(); -} - -.o_NotificationRequest_partnerImStatusIcon { - @include o-mail-notification-list-item-partner-im-status-icon-layout(); -} - -.o_NotificationRequest_sidebar { - @include o-mail-notification-list-item-sidebar-layout(); -} - -// ------------------------------------------------------------------ -// Style -// ------------------------------------------------------------------ - -.o_NotificationRequest { - @include o-mail-notification-list-item-style(); - - &:hover { - .o_NotificationRequest_partnerImStatusIcon { - @include o-mail-notification-list-item-hover-partner-im-status-icon-style(); - } - } -} - -.o_NotificationRequest_core { - @include o-mail-notification-list-item-core-style(); -} - -.o_NotificationRequest_name { - @include o-mail-notification-list-item-bold-style(); -} - -.o_NotificationRequest_partnerImStatusIcon { - @include o-mail-notification-list-item-partner-im-status-icon-style(); -} diff --git a/addons/mail_bot/static/src/components/notification_request/notification_request.xml b/addons/mail_bot/static/src/components/notification_request/notification_request.xml deleted file mode 100644 index 10b22bac2cd..00000000000 --- a/addons/mail_bot/static/src/components/notification_request/notification_request.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<templates xml:space="preserve"> - - <t t-name="mail_bot.NotificationRequest" owl="1"> - <div class="o_NotificationRequest" t-on-click="_onClick"> - <div class="o_NotificationRequest_sidebar"> - <div class="o_NotificationRequest_imageContainer o_NotificationRequest_sidebarItem"> - <img class="o_NotificationRequest_image rounded-circle" src="/mail/static/src/img/odoobot.png" alt="Avatar of OdooBot"/> - <PartnerImStatusIcon - class="o_NotificationRequest_partnerImStatusIcon" - t-att-class="{ 'o-mobile': env.messaging.device.isMobile }" - partnerLocalId="env.messaging.partnerRoot.localId" - /> - </div> - </div> - <div class="o_NotificationRequest_content"> - <div class="o_NotificationRequest_header"> - <span class="o_NotificationRequest_name" t-att-class="{ 'o-mobile': env.messaging.device.isMobile }"> - <t t-esc="getHeaderText()"/> - </span> - </div> - <div class="o_NotificationRequest_core"> - <span class="o_NotificationRequest_coreItem o_NotificationRequest_inlineText"> - Enable desktop notifications to chat. - </span> - </div> - </div> - </div> - </t> - -</templates> diff --git a/addons/mail_bot/static/src/models/messaging/messaging.js b/addons/mail_bot/static/src/models/messaging/messaging.js index a95171ccf69..58923e8e997 100644 --- a/addons/mail_bot/static/src/models/messaging/messaging.js +++ b/addons/mail_bot/static/src/models/messaging/messaging.js @@ -8,15 +8,6 @@ registerInstancePatchModel('mail.messaging', 'mail_bot/static/src/models/messagi // Public //---------------------------------------------------------------------- - /** - * @returns {boolean} - */ - isNotificationPermissionDefault() { - const windowNotification = this.env.browser.Notification; - return windowNotification - ? windowNotification.permission === 'default' - : false; - }, }); }); diff --git a/addons/mail_bot/static/src/models/messaging_menu/messaging_menu.js b/addons/mail_bot/static/src/models/messaging_menu/messaging_menu.js deleted file mode 100644 index cb411be987c..00000000000 --- a/addons/mail_bot/static/src/models/messaging_menu/messaging_menu.js +++ /dev/null @@ -1,28 +0,0 @@ -odoo.define('mail_bot/static/src/models/messaging_menu/messaging_menu.js', function (require) { -'use strict'; - -const { registerInstancePatchModel } = require('mail/static/src/model/model_core.js'); - -registerInstancePatchModel('mail.messaging_menu', 'mail_bot/static/src/models/messaging_menu/messaging_menu.js', { - - //---------------------------------------------------------------------- - // Private - //---------------------------------------------------------------------- - - /** - * @override - */ - _updateCounter() { - let counter = this._super(); - if (!this.messaging) { - // compute after delete - return counter; - } - if (this.messaging.isNotificationPermissionDefault()) { - counter += 1; - } - return counter; - }, -}); - -}); diff --git a/addons/mail_bot/static/src/widgets/notification_alert/notification_alert.js b/addons/mail_bot/static/src/widgets/notification_alert/notification_alert.js deleted file mode 100644 index feeb0595832..00000000000 --- a/addons/mail_bot/static/src/widgets/notification_alert/notification_alert.js +++ /dev/null @@ -1,45 +0,0 @@ -odoo.define('mail_bot/static/src/widgets/notification_alert/notification_alert.js', function (require) { -"use strict"; - -const components = { - NotificationAlert: require('mail_bot/static/src/components/notification_alert/notification_alert.js'), -}; - -const { ComponentWrapper, WidgetAdapterMixin } = require('web.OwlCompatibility'); - -const Widget = require('web.Widget'); -const widgetRegistry = require('web.widget_registry'); - -class NotificationAlertWrapper extends ComponentWrapper {} - -// ----------------------------------------------------------------------------- -// Display Notification alert on user preferences form view -// ----------------------------------------------------------------------------- -const NotificationAlert = Widget.extend(WidgetAdapterMixin, { - /** - * @override - */ - init() { - this._super(...arguments); - this.component = undefined; - }, - /** - * @override - */ - async start() { - await this._super(...arguments); - - this.component = new NotificationAlertWrapper( - this, - components.NotificationAlert, - {} - ); - await this.component.mount(this.el); - }, -}); - -widgetRegistry.add('notification_alert', NotificationAlert); - -return NotificationAlert; - -}); diff --git a/addons/mail_bot/static/src/widgets/notification_alert/notification_alert_tests.js b/addons/mail_bot/static/src/widgets/notification_alert/notification_alert_tests.js deleted file mode 100644 index beeeb2a8e4e..00000000000 --- a/addons/mail_bot/static/src/widgets/notification_alert/notification_alert_tests.js +++ /dev/null @@ -1,101 +0,0 @@ -odoo.define('mail_bot/static/src/widgets/notification_alert/notification_alert_tests.js', function (require) { -'use strict'; - -const { afterEach, beforeEach, start } = require('mail/static/src/utils/test_utils.js'); - -const FormView = require('web.FormView'); - -QUnit.module('mail_bot', {}, function () { -QUnit.module('widgets', {}, function () { -QUnit.module('notification_alert_tests.js', { - beforeEach() { - beforeEach(this); - - this.start = async params => { - let { widget } = await start(Object.assign({ - data: this.data, - hasView: true, - // View params - View: FormView, - model: 'mail.message', - arch: ` - <form> - <widget name="notification_alert"/> - </form> - `, - }, params)); - this.widget = widget; - }; - }, - afterEach() { - afterEach(this); - }, -}); - -QUnit.skip('notification_alert widget: display blocked notification alert', async function (assert) { - // FIXME: Test should work, but for some reasons OWL always flags the - // component as not mounted, even though it is in the DOM and it's state - // is good for rendering... - assert.expect(1); - - await this.start({ - env: { - browser: { - Notification: { - permission: 'denied', - }, - }, - }, - }); - - assert.containsOnce( - document.body, - '.o_notification_alert', - "Blocked notification alert should be displayed" - ); -}); - -QUnit.test('notification_alert widget: no notification alert when granted', async function (assert) { - assert.expect(1); - - await this.start({ - env: { - browser: { - Notification: { - permission: 'granted', - }, - }, - }, - }); - - assert.containsNone( - document.body, - '.o_notification_alert', - "Blocked notification alert should not be displayed" - ); -}); - -QUnit.test('notification_alert widget: no notification alert when default', async function (assert) { - assert.expect(1); - - await this.start({ - env: { - browser: { - Notification: { - permission: 'default', - }, - }, - }, - }); - - assert.containsNone( - document.body, - '.o_notification_alert', - "Blocked notification alert should not be displayed" - ); -}); - -}); -}); - -}); diff --git a/addons/mail_bot/views/assets.xml b/addons/mail_bot/views/assets.xml index 36371ea3f25..e41f3ed6f03 100644 --- a/addons/mail_bot/views/assets.xml +++ b/addons/mail_bot/views/assets.xml @@ -4,19 +4,11 @@ <template id="assets_backend" name="mailbot assets" inherit_id="web.assets_backend"> <xpath expr="script[last()]" position="after"> <script type="text/javascript" src="/mail_bot/static/src/bugfix/bugfix.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/components/messaging_menu/messaging_menu.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/components/notification_alert/notification_alert.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/components/notification_list/notification_list.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/components/notification_request/notification_request.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/models/messaging/messaging.js"></script> <script type="text/javascript" src="/mail_bot/static/src/models/messaging_initializer/messaging_initializer.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/models/messaging_menu/messaging_menu.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/widgets/notification_alert/notification_alert.js"></script> </xpath> <xpath expr="link[last()]" position="after"> <link rel="stylesheet" type="text/scss" href="/mail_bot/static/src/scss/odoobot_style.scss"/> <link rel="stylesheet" type="text/scss" href="/mail_bot/static/src/bugfix/bugfix.scss"/> - <link rel="stylesheet" type="text/scss" href="/mail_bot/static/src/components/notification_request/notification_request.scss"/> </xpath> </template> @@ -29,9 +21,7 @@ <template id="qunit_suite" name="mailbot_tests" inherit_id="web.qunit_suite_tests"> <xpath expr="." position="inside"> <script type="text/javascript" src="/mail_bot/static/src/bugfix/bugfix_tests.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/components/messaging_menu/messaging_menu_tests.js"></script> <script type="text/javascript" src="/mail_bot/static/src/models/messaging_initializer/messaging_initializer_tests.js"></script> - <script type="text/javascript" src="/mail_bot/static/src/widgets/notification_alert/notification_alert_tests.js"></script> </xpath> </template> </data> diff --git a/addons/mail_bot/views/res_users_views.xml b/addons/mail_bot/views/res_users_views.xml index 36bb1abf22c..e714ff6b438 100644 --- a/addons/mail_bot/views/res_users_views.xml +++ b/addons/mail_bot/views/res_users_views.xml @@ -27,17 +27,4 @@ </data> </field> </record> - - <!-- Blocked notification alert --> - <record id="view_users_form_inherit_mail_notification_alert" model="ir.ui.view"> - <field name="name">res.users.preferences.form.notification.alert</field> - <field name="model">res.users</field> - <field name="inherit_id" ref="base.view_users_form_simple_modif"/> - <field name="arch" type="xml"> - <xpath expr="//field[@name='image_1920']" position="before"> - <widget name="notification_alert"/> - </xpath> - </field> - </record> - </data></odoo> |
