summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/services/notification_service.js
AgeCommit message (Collapse)Author
2019-06-28[IMP] web, *: display rpc warnings with toastsfja-odoo
* = test_website, partner_autocomplete - All the rpc warnings are now displayed using the notification system of https://github.com/odoo/odoo/commit/b94395b50175925fc7d1bd3655e5facb78a8ba2b - test_website is up to date Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-04-24[IMP] web, *: share and improve notification systemqsm-odoo
* barcodes, calendar, partner_autocomplete, web_settings_dashboard Make the notification system better, using bootstrap toast component, and make it available in the frontend. The toast component allowed to remove some JS code and made the component customizable by themes but it had to be reviewed/fixed to make it functional (maybe bootstrap will review its work in next versions). This work should still be improved because there are still too many ways (deprecated and not deprecated) to instantiate toasts in the backend. The goal here was however to make the toasts more modern and make them available in the frontend. This work is needed for some tasks. @kig-odoo and @fja-odoo made a pre-work to instantiate toasts in the frontend for their respective tasks. This commit unifies the system. Part of https://github.com/odoo/odoo/pull/32793 task-1970731 closes odoo/odoo#32793 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-10[FIX] calendar: notifications may appearChristophe Matthieu
Following the transformation into notification service, performed by commit 07cd24b1ecf3ab8edd3fffbf2fcd3a3e685f357c, calendar has been forgotten.
2018-08-09[IMP] web: remove useless service nameChristophe Matthieu
We use the registry keys as name for the services.
2018-07-02[REF] mail: JS mail refactoringAlexandre Kühn
---------------------- Summary ---------------------- The purpose of this commit is to improve the JS code of the `mail` module. It applies the new coding guidelines and makes some changes on the design of some modules, such as the old ChatManager module. Here is a short summary of the changes that have been made: 1. New coding guidelines - snake_case to camelCase - prefix private attributes and methods with '_' - jsdoc on most methods - one class per module 2. Rename/Merge some classes - 'chat manager' becomes 'mail manager' (internal) and 'mail service' (external) - 'chat window manager' is now included in mail manager - 'thread' widget now named 'thread widget' 3. New model abstraction for mail objects: - modules 'mail.model.*' - modeling: 0..1 0..1 * * ThreadWindow <------> Thread <-------> Message / \ / \ Thread With Cache Document Thread / | \ / | \ Mailbox Channel Support Channel | | DM - Thread: the superclass of threads. - ThreadWindow: the window component of a thread. - Message: mail objects representing messages. - Thread With Cache: threads that can be used with search view (Discuss app compatible). - Document Thread: represents the thread part of a chatter. - Mailbox: represents what was previously called 'static' channel, e.g. 'Inbox'. - Channel: mail objects representing channels, including livechat. - DM: special kind of Channel for 1:1 communication in the backend. - Support Channel: special channel for im_support module. This new modeling approach let us easily add features on all threads, such as the possibility to put any thread in a small window. ---------------------- Known issues ---------------------- [Already Present in Master] 1. When the Discuss app is in the background with 'Inbox' as the selected Thread, when clicking on a document thread preview in the messaging menu of the systray, the rainbow man appears. 2. When a document with the chatter is in the background, when receiving an inbox notification from this document thread, the document thread is automatically marked as read, which removes the notification right away. 3. Sometimes, opening a DM window from the "blank" thread window does not work. 4. Reply-to feature on Inbox is not working: no message is sent in the document thread. 5. On the first login of admin user with demo data, the inbox counter is wrong (it displays 6, instead of 3). Explanation after investigation: > On page load, it fetches the correct number of Inbox messages (3), but the server notifies of 3 needaction messages right away, so it wrongly assumes these are new needaction messages. > Not possible for web client to detect that these messages should not increment the Inbox counter while keeping same API. 6. Notifications for new document thread messages only work when the user sets 'handle with Odoo' for the Notification Management in the preferences. > due to notifications on the longpoll bus for document thread messages that come from needaction notifications. > requires server-side changes to send notification on the longpoll bus to mentionned user. [New] 7. When receiving a message on a unjoined channel, thread window flickers ('open' > 'close' > 'open') Explanation after investigation: > JS logic: a) On auto-join, ask server to join the channel and get channel infos. b) The info tells the channel is not detached, but JS code makes decision to detach it, and tells server the channel is now detached. c) From (a), server notifies on longpoll bus the state of channel, which is not detached. The web client thinks that the window state of the channel has been changed somewhere else, and the channel is now closed. d) From (b), server notifies on longpoll bus the state of channel, which is detached. The web client opens the thread window of this channel. > The flicker didn't occur before refactoring because the web client was only updating the model of channel when it receives the longpoll notification. > Server behaviour on 1st longpoll notification is necessary for cross-tab synchronization for channel window state. > New design implies that model and view should be synchronized, hence the issue now. > Solution: remove server-side thread window synchronization and replace with client-side synchronization. ---------------------- Hacks ---------------------- The module `im_livechat` now uses mail objects that are compatible with Message and Window objects: Modeling for messages: AbstractMessage / \ / \ LivechatMessage Message - AbstractMessage: message compatible with the thread widget. - LivechatMessage: message used by im_livechat. - Message: message used with the mail manager. Modeling for thread windows: AbstractThreadWindow / \ / \ LivechatWindow ThreadWindow - AbstractThreadWindow: behaviour share between all types of thread windows. - LivechatWindow: window used by im_livechat. - ThreadWindow: window used with mail_manager. The reason for these hacks are twofold: 1. Use the thread widget in the frontend and livechat external lib bundles. 2. Do not have a dependency with the mail manager in the frontend and external lib bundles.
2018-04-19[DOC] web: add documentation on notification systemGéry Debongnie
Also, fix a few errors in the js docstring
2018-04-19[IMP] web: convert notification popup in service and add buttons paramsChristophe Matthieu
this.call('web.Notification', 'notify', params) Display a notification at the appropriate location, and returns the reference id to the same widget. Note that this method does not wait for the appendTo method to complete. @param {Object} params @param {string} params.title notification title @param {string} params.message notification main message @param {string} params.type 'notification' or 'warning' @param {boolean} [params.sticky=false] if true, the notification will stay visible until the user clicks on it. @param {string} [params.className] className to add on the dom @param {function} [params.onClose] callback when the user click on the x or when the notification is auto close (no sticky) @param {Array<Object>} params.buttons @param {function} params.buttons[0].click callback on click @param {Boolean} [params.buttons[0].primary] display the button as primary @param {string} [params.buttons[0].text] button label @param {string} [params.buttons[0].icon] font-awsome className or image src @returns {Number} notification id this.call('web.Notification', 'close', notificationId)