summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/services
AgeCommit message (Collapse)Author
2019-03-06[REF] mail: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-22[MERGE] forward port branch saas-12.1 up to 0f4abc5c228Christophe Simonis
2019-02-14[FIX] mail: enable seen feature only on direct chatsAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/844fb2b51ea7cfa557b19466c0a53dde19433e7a There were performance issue with the seen feature in multi- user channnels, therefore it has been disabled for them. As a result, only direct chats have this feature.
2019-02-12[FIX] mail: throttle batched `channel_fetched` RPCsAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/844fb2b51ea7cfa557b19466c0a53dde19433e7a The commit above added the seen icon on messages in a channel. However, since this feature, there was a performance issue when opening the systray messaging menu with several pinned channels: lots of RPCs are made, almost 1 for each preview in the messaging menu. The RPCs comes from the reception of the last message in the channel, to let the current user notify that he has received the messages in the channel. Those RPCs were made for each channel, thus the more pinned channels the more RPCs were made when opening the messaging menu. This commit fixes the issue by throttling and batching the RPCs. To do so, instead of letting the channel model handle the RPC `channel_fetched`, the mail service now handles it. This has the advantage to throttle the RPC globally and to batch the requests to notify that messages have been received on channels. closes odoo/odoo#31026
2019-02-11[MERGE] forward port branch saas-12.1 up to 93d736e905eChristophe Simonis
2019-02-07[IMP] mail: correctly patch mail status manager timersXavierDo
We want to avoid that a `setTimeout` started in one test has an impact on other tests. This is especially true with the status update loop. Since mail_service is used in multiple tests, the safest solution is to patch timeouts everytime we make a call to getMailServices. There is no need for an unpatch, the patch become the default behaviour until the page is refresh at the end of tests. It is possible to manually add the patch after calling `getMailServices` ``` this.services = mailTestUtils.getMailServices(this); this.timeoutMock = mailTestUtils.patchMailTimeouts(); ``` This can be usefull if we want to get the timeoutMock to simulate time changes. Task: 1856205
2019-02-07[MERGE] forward port branch 12.0 up to a46138cb019Christophe Simonis
2019-02-07[IMP] bus, mail, mail_bot: add im_status serviceXavierDo
This commit is a refactoring of im_status management. This commit also add im_status in two places, near the author in a mail thread and on each suggestion when using mentions. A service to manage im_status will have multiple benefits here: -centralise information, avoid to call the server multiple time for the same im_status -update all im_status at once and keep consistency in display. With this commit, the im_status updates are now done by rpc call. Updates where previously made with the bus but this has some drawback, since the bus will only give the information 50 seconds after the beginning of the request, in the worst case, we van wait 2*50 seconds to get an update. More than that, the im_status where only updates for pinned dm_chat. Dm chat are synchronized cross tabs, making the use of the bus possible for this purpose. Since we will need to display im_status not linked to dm_chat, the list to update will be different from tab to tab making the use of bus difficult for this purpose. Technical notes: -im_search has been moved from bus to mail addons since it concerns mail.channel -Update of an im_status should be reflected everywhere in the page. Since im_status is a rendered template used in multiple widget, we should add the correct logic to all concerened widget. The current solution is simple: use a jquery selector to find every place where im_status is rendered. -we add a new im_status: im_partner. This will indicate that that the partner has no user linked to him, making it possible to avoid to ask for status updates for this partner. -The update will only be done when the tab is focused. (and will be done asap once the tab get focus back)
2019-02-01[FIX] mail: do not open chat window twiceAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/0d87b1ccea07b952d9079008cfa3cddaf1ccdbee The commit above prevents opening a chat window when we do not have access to messages of the conversation. This may happen when receiving a notification from a document we do not have access rights. However, the changes in the code above has an unintended side-effect of opening a chat window twice when clicking on a channel preview from the systray messaging menu. This happens because when clicking on a preview, it detaches the thread and opens the chat window. Meanwhile, there is a RPC to notify that the chat window is detached, and the new window state of the channel is received on the longpolling. Two concurrent attempts to open a chat window occur at the same. It was working fine before the commit above, because the registering of a newly open chat window was synchronous. This is however no longer the case, because it fetches messages beforehand: it has become a requirement to open a chat window. Since the registering of a newly open chat window is now asynchronous, it was fetching messages and opening the chat window twice. This commit fixes the issue by aborting attempt to open a chat window if it's currently opening a chat window, as this process may take some time due to the `message_fetch` RPC. closes odoo/odoo#30741
2019-01-31[MERGE] forward port branch 12.0 up to cb8fefa8999Christophe Simonis
2019-02-04[MERGE] forward port branch saas-12.1 up to 4524ad06a8aChristophe Simonis
2019-01-21[FIX] mail: do not open document chat window without access rightsAlexandre Kühn
Before this commit, a user could unintentionally discard a notification from a document that he does not have access rights at the moment. Steps to reproduce: 1. Setup: - Odoo with multi-company - Two companies: "MyCompany" and "SuperCompany" - Two users "Admin" and "Demo", both have access to being in both companies - "Demo" has Notification management in Odoo in the user preferences. - "Admin" is logged in "MyCompany" - "Demo" is logged in "SuperCompany" 2. Scenario: - "Admin" mentions "Demo" in a log of a document from "MyCompany" - "Demo" receives the notification and click on the notification from messaging menu. > Dialog prompts that Demo does not have access to the document (OK) > Empty chat window is open (not OK) - "Demo" closes the chat window > Notification is marked as read (not OK) This commit fixes the issue by aborting the opening of a chat window if the user does not have the access rights at the moment. It should prevent marking the notification as read by mistake by closing the chat window. Task-ID 1931313 closes odoo/odoo#30414
2019-01-11[FIX] mail: chat window positioning with discuss openAlexandre Kühn
Before this commit, the process of positioning chat windows could fail if one of the tabs had discuss open. When a chat window was hidden and become visible, the algorithm was not updating the state of the chat window to "visible" when discuss was open. As a result, it was always trying to make it visible, resulting in an infinite loop and raising the following error message: `Uncaught RangeError: Maximum call stack size exceeded` This commit ensures it works even when discuss is open. opw-1919327 closes odoo/odoo#30137
2019-01-09[FIX] mail: typo connect notification errorNicolas Lempereur
In 12.0 commit f2302dfb2 the method openDmWindow was renamed openDMChatWindowFromBlankThreadWindow but it called openDmWindow at one location which caused click on user connection notification to cause an error instead of opening a chat window. opw-1910521 closes #30084
2019-01-14[MERGE] forward port branch 12.0 up to 6a0675d36ddChristophe Simonis
2018-12-06[IMP] mail: channel seen icon indication ('v' and 'vv')Alexandre Kühn
This commit adds the seen icon next to a message for all channels except livechat. It tracks received and seen messages for all members of the channel. Icon is either 1 or 2 check(s) ('v' or 'vv'). Those are the different states of this 'seen' icon: ICON: DESCRIPTION: no check .................. no one has received the message. 1 check ................... some members have received the message, no one has seen it. 2 checks (greyed-out) ..... some members have seen the message, some or everyone has received it 2 checks (green) .......... all members have seen the message This icon is not shown for messages preceding the last message seen by everyone, in order to reduce visual noise. Task-ID 1881001
2018-12-06[IMP] im_livechat, mail: improved "is typing" notificationAlexandre Kühn
With this commit, the UI for "is typing..." notifications has changed. ** before **: In Discuss & chat windows, "is typing..." notification bar at the bottom of the thread, inside the conversation. ** after ** In chat windows, animated '...' next to conversation name. In Discuss, animated '...' next to conversation name in sidebar, and text below the composer. Task-ID 1881001
2018-12-03[FIX] mail: do not auto-focus new open chat windowAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/cd34f6de727d5b3858420cff3c9d3c5995c4e75c Before this commit, when receiving a new message from a new DM or livechat, the newly opened chat window was automatically focused and marking messages as read. Chat windows that are automatically opened without any user interaction, such as when receiving a new message from a chat, should not be focused. Those chat windows are "passive", and the user must click on them in order to have focus and mark messages as read (the chat window is no longer passive as a result). The bug has been introduced by the refactoring from the commit above. In fact, there was a very short period of time during which the chat window was passive. However, due to the way chat window server-side state synchronization works, the chat window was automatically closed then re-opened. This resulted in some visual flickering of the chat window ('open' > 'close' > 'open'), and the conversation was automatically marked as read. This was a consequence of the actions 'open' > 'close' > 'open' that removed the passive property of the chat window. Chat window server-side synchronization relies on a notification that tells the state of the conversation. Due to bad design, this notification had exactly the same format as the one for notifying all browser tabs of a newly joined conversation. This commit fixes the issue by distinguishing "channel join" and "chat window state" notification, so that the former is not treated as a chat window notification. It fixes the problem because it was precisely the "channel join" notification that caused the chat window to close and loose its passive property. Task-ID 1914735 opw-1914371 closes odoo/odoo#29223
2019-01-28[MERGE] forward port branch saas-12.1 up to d3b8422c9c4Christophe Simonis
closes odoo/odoo#30614
2019-01-10[Generic] unaccent searchmgh-odoo
- added unaccent search on POS customer/partner and product - moved unaccent from "mail.utils" to "web.utils" - added more character to make function accurate We might use str.normalize(from ES6) but the problem is str.normalize method can not consider some double characters i.e. accented character when normalized it returns 2 normal characters and normalize method returns single character, so here custom unaccent method is used to normalize the string What we can improve here: We can use str.normalize method and check if string is still have unaccented charaters that we can call our unaccent method but this unaccent method is also working and performing well closes odoo/odoo#27671
2019-01-02[IMP] mail: group mailFailures by type in systrayAntoine Prieels (ANP)
We want to add new kinds of failures to the list in the systray, such as Snailmail or SMS failures. Until now, failures linked to documents of the same model were grouped together in the systray. Different types of failures should not be grouped in a single line so we add a '_failureType' variable to mailFailures and group them only if their type is the same. closes odoo/odoo#29855
2018-11-26[FIX] mail: messaging menu show undated DM previews lastAlexandre Kühn
This commit fixes two related issues: 1. Previews without any message should not be dated. Before this commit, when a channel or dm preview had no date, it was displaying the current date. This commit fixes the issue by not showing the date for those previews. 2. Dates previews should appear before undated previews. Before this commit, undated previews were considered similarly as dated previews in the ordering of previews in the messaging menu. Since DMs are shown before Channels, any pinned DM without any message were displayed on top of messages with some message. This commit fixes the issue by putting undated previews after dated ones. This rule is applied before considering type of the thread (i.e. DMs before channels). Task-ID 1912001
2018-11-16[FIX] mail: easily mention followers and employees in chatterAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/cd34f6de727d5b3858420cff3c9d3c5995c4e75c Resulting of the mail JS refactoring, the list of prefetched suggestions has been changed as follow: - before: list of list of mention suggestions `{Array<Object[]>}` - after: list of mention suggestions `{Object[]}` The change resulted in wrongly thinking that wrapping the list of suggestions in a list was pointless, thus simplifying it as a simple list of mention suggestions. However, because of this change, it has become much harder to mention employees and followers of documents from the chatter: it now always fetches all partner suggestions at all time, whereas before it was suggesting followers, then employees, and finally all partners based on the input of the user. In fact, there was a purpose of using a list of list of prefetched mention suggestions, which is to group suggestions by "priority": followers first, then employees, and all partners as a last resort. This commit re-introduces prefetched mention suggestions as a list of list of partners, so that it re-becomes easier to mention followers and partners of a document from the chatter. Task-ID 1910111
2018-08-30[IMP] mail, mail_bot: improved push notifications permission responseAlexandre Kühn
This commit makes small improvements on the messaging menu with the new module `mail_bot`: [IMP] When OdooBot has a request, it now adds "+1" to the counter of the messaging menu. The related preview also has a bold title, and displays "(1)" next to the title. [REF] Static previews are no longer in mail_service. This was only used for "OdooBot has a request" preview. This logic has now been moved to the module `mail_bot` (was previously in `mail`). [FIX] Title of response of push notifications permission clearly states whether permission has been granted or denied (was displaying "[Object object]" before this commit). Task-ID 1877502
2018-08-30[FIX] mail: correctly handle (non-)passive thread windowsAlexandre Kühn
Definition of '(non-)passive' thread window: Thread windows can be either 'passive' or 'active' (default: 'active'). - When opening a thread window in 'active' mode, the messages are marked as read, and the focus is on the thread window. - When opening a thread window in 'passive' mode, the messages are not marked as read and there is no focus on the thread window. Messages are kept unread until the user interacts with the thread window (e.g. by clicking on composer). When the user intentionally opens a thread window, it should be open in active mode. However, when a thread window is open without any user iteractions, it should open in passive mode. The later case is useful in some cases. For instance, when receiving a new message from a DM conversation, it should automatically open the corresponding thread window. However, it should not automatically mark messages as read. This commit contains 2 bug fixes: 1. When receiving a new message on an active thread window, it no longer increments the unread counter. (When the focus is on the composer of the thread window, the user is immediately reading newly received messages.) 2. When receiving a new message from an unpinned DM conversation, the newly open thread window is always passive. (This was not the case before, so when receiving new messages, it did not increment the unread counter.)
2018-08-27[FIX][REF] mail: several thread windows fixesAlexandre Kühn
This commit fixes some bugs on thread windows, and make some improvements on tests related to thread windows. Fixes: 1. Correctly position last visible thread window when there are more open thread windows than available slots. 2. Closing a thread window now marks it as read. 3. Can now fold/unfold the blank thread window (aka 'New' thread window). Tests cleaning: 1. Removed unnecessary 'before assertions' in thread window tests. > Solved with this: https://github.com/odoo/odoo/commit/9b1daa1218f7adf9d741afba607ef5b55b16e3e6 1. Added basic rendering test for a (non-blank) thread window. 2. Cleaned thread window tests > Split in different files. > Grouped in 'Thread Window' QUnit module.
2018-08-21[FIX] mail: remove bolt on notification requestXavierDo
Since the title of a notification is in a t-esc, the style wont be applied
2018-08-21[IMP] mail_bot: change Odoobot to OdooBotXavierDo
2018-08-17[IMP] mail_bot: improve answers, initialisation and othersXavierDo
1. Odoobot shouldn't talk to admin when demo data are installed Odoobot will talk to a user on it's first connection, meaning that a dev will see this chat window a lot. The state disabled is not a real state but is explicit, the odoobot wont be initialized in this case. It is still possible to test odoobot flow with demo user. 2. remove old odoobot image and update link 3. small improvements in odoobot answers
2018-08-16[FIX] mail: mark all messages as read from InboxAlexandre Kühn
Before this commit, there was a traceback when attempting to mark all messages as read from the 'Inbox' of Discuss. This is due to resetting the 'needaction' counter on threads that do not not track 'needaction', such as the 'Starred' mailbox. In fact, only channels do track them and handle a needaction counter, so this should only be applied on channels.
2018-08-14[FIX] mail: update dm chat ok for f2302dfbNicolas Lempereur
In f2302df dm type of channel was renamed to dm_chat, this commit takes this into account in other part of the code.
2018-08-13[IMP] mail, im_livechat: 'is typing...' indicator on mail channelsAlexandre Kühn
With this commit, most threads show an indicator when a member is typing something. e.g. "Mitchell Stephens is typing..." Supported threads: - DM - (public & private) channels - Livechat (Website & Backend) Unsupported threads: - mailboxes (e.g. 'Inbox') - document thread (= 'Chatter') - support channel (with `im_support` module) Some technical details: - This is a mix between 'start'/'stop' and 'regular notify' strategies. - On typing text in composer: notify 'start typing' to all members of thread. - On clearing text in composer: notify 'stop typing' to all members of thread. - A member can only notify once every 2.5 seconds to the server when he starts or stops typing something (throttled, buffered notify call). - On receiving a message from someone that is typing: determine that he is no longer typing. - On non-empty and unchanged composer text for 5.0 seconds: automatically notifies all members of thread that he is no longer typing anything. (This is like a 'soft / cooperative sender' timeout). - On non-receiving a typing notification of someone after 60 seconds: determine that he is not longer typing something (This is like a 'hard / receiver assumption' timeout). - When some types for more than 50 seconds straight: notify that he is still typing something (again and again every 50 seconds). - When two or more people are typing something (Multi-User channels), it displays at most 2 typing users (ordering rule: longer typers first): "Mitchell Stephens, Marc Brown and more are typing..." - Timing summary: - Usually 2.5 seconds uncertainty. - Up to 5.0 seconds uncertainty on typer inactivity. - Up to 60 seconds uncertainty on typer page reload / browser tab closed / etc. Future Improvements: - Detect page reload or browser tab close with loose of longpolling connection Task-ID 28188
2018-08-13[FIX] mail: display new messages on reload for document threads without any nameAlexandre Kühn
A document thread is a JS-only entity, which is built from data on 'mail.message' received from the server, or from data of a document. When we detect a change on the message IDs related to a document thread, we should update this list on the document thread, so that it knows which messages haven't be fetched from the server yet. However, the list of message IDs was not updated on a document thread when no name could be provided to the document thread, which occurs when there is no no `display_name` data to determine on the record's name. In this case, it should update the list of message IDs on this document thread without altering document name. However, it was neither changing the document name nor updating the message IDs. This commit fixes this issue by independently update message IDs and the document name of a document thread.
2018-08-13[FIX] mail: messaging menu last message when receiving new messageAlexandre Kühn
Before this commit, when we received a new message, the counter was correctly updated, but not the last message in the messaging menu preview. This is due to making changes to the counter before adding the message in the thread. When there is a change in the unread counter of a thread, it warns its views. The messaging menu renders the previews of each threads in the preview items, using in particular the last message in the thread. This commit fixes the issue by making changes on the unread counter of a thread after the message has been added to the thread.
2018-08-13[REF][FIX] mail, im_livechat: various improvements (JS)Alexandre Kühn
This commit makes a lot of small improvements of the JS of mail and related modules. A. Mail Manager --------------- im_support: - [REF] Slightly more robust way to determine a support message, so that it more reliably falls back on default kind of message (i.e. support channel UUID should be clearly set). mail: - [REF] Improved method names for readability purposes. Some examples: - `fetchFromServer` becomes `fetchMailStateFromServer` - `_initialize{*}` becomes `_update{*}FromServer` - `_isModerator` becomes `_isMyselfModerator` - [REF] Use 'template' pattern design to make Include on Mail Manager much more robust. In particular, the flow is always as follow: 1. Initialize internal state. 2. Listen on buses. 3. Fetch mail data from server. - [REF] Improved workflow for thread window workflow (Shorter & more readable). B. Mail Tests ------------- - [REF] Thread Window Tests crashes with clean message when there are some thread windows open before running the tests. C. (Model) Message ------------------ - [REF] Improved method names for readability purposes (e.g. `isAuthor` becomes `isMyselfAuthor`). D. (Model) Thread ----------------- - [REF] Improved `init` parameters on each kind of thread. - [REF] 'Thread With Cache' has been renamed to 'Searchable Thread': it embraces all kinds of threads that can be used with the search view. - [REF] 'DM' has been renamed to 'DM Chat' (for clarity). - [IMP] New Livechat model in the backend. - [REF] No more direct instances of the Channel class: public and private channels are now 'Multi-User' channels, while DM Chat and Livechat are 'Two-User' channels: This change has been made so that instances of classes always have direct classes as "leaf" in the Class modeling. It eases making changes to a certain model without being too constrained by another model. - [REF] As a consequence of above changed, the method `isChat` has been renamed to `isTwoUserThread`. This is to avoid confusion with the terminology 'chat', which is more like a shortcut for 'quick real- time conversation'. In other words, the property of 'chat' depends of the way to interact on a thread, not of the intrinsic type of the thread. Still, some parts have kept the terminology 'chat', such as in the systray messagin menu. - [IMP] Added `message_added` and `message_posted` hooks, which may be useful to easily hook on those events. E. Thread Widget ---------------- - [REF] Now uses a `mail.model.AbstractThread` for the rendering of a thread, instead of a list of `{mail.model.AbstractMessage}`. - [FIX] Stick thread scroll height to bottom on new rendering, if it was previously at the bottom of the thread. - [REF] Option ORDER has its meaning changed: it now refers to the chronological order of messages in the thread, in which DESC means 'from top to bottom', while ASC means 'from bottom to top'. - [REF] Improved doc on templates, in particular with the option `ORDER`. F. Thread Window ---------------- - [REF] Moved more logic to thread windows, which were previously in Mail Window Manager. - [REF] Now hides the thread widget attribute. So instead of `threadWindow.threadWidget.isAtBottom()`, it uses `threadWindow.isAtBottom()`. - [FIX] New received messages when not having focus on Odoo tab should always make the corresponding thread windows "passive" (i.e. windows that keep threads unread until click on them). - [FIX] Blank thread window (i.e. 'New message' TW) correctly opens Discuss with 'Inbox' when clicking on 'Expand' Button in the title - [FIX] Do not display the composer for channels with property 'mass-mailing' set in thread windows. G. (Website) Livechat --------------------- - [REF] Some `trigger` have been turned into `trigger_up`. - [REF] Some logic has been moved to models (e.g. `{im_livechat.model.WebsiteLivechat}`), from `{im_livechat.im_livechat.LivechatButton}`. - [FIX] New messages should be received in real-time. The longpolling was broken with a recent refactoring on bus service (6448420c5dd160470e465dee7729d19d8d5e7bab).
2018-08-10[REF] *: add support for RTL languagesMartin Trigaux
מזל טוב The direction parameter will now have a real impact on the web interface and completly switch the direction of the interface. Add the dependency rtlcss to switch the direction with a css postprocessor. Two different assets will be generated for ltr or rtl /web/content/<...>/web.assets_backend.0.css and /web/content/<...>/rtl/web.assets_backend.0.css to be able to differentiate it easily Adapt the css and views to be easier to switch direction Render graph as it is, do not move y-axis right side, as per mathematical rule value goes left from origin are considered negative, so keep graph as it is for right to left language add test cases for language direction specific assets bundle if language direction is rtl then we also store css files in assets bundle now we store two assets bundle, one for ltr and one for rtl language direction test two assets bundles generated, also test two assets bundle generated for en_US and ar_SY
2018-08-10[IMP] auth_signup, mail: notify inviter user when invited user connectsXavierDo
Purpose of this commit is to improve the onboarding and the first steps of Odoo notably when using Discuss and inviting first people to join Odoo. When a new user connects the user who invited him will be notified with a desktop notification inviting him to have a chat in Discuss and talk together. This commit is linked to task ID 1838588 and PR #25075.
2018-08-10[IMP] mail: add a desktop notification request to systrayXavierDo
Purpose of this commit is to improve the onboarding and the first steps of Odoo notably when using Discuss and inviting first people to join Odoo. In this commit we now ask the user to activate desktop notifications. Like already done in Discuss a message will appear in systray in order to ask the user to do it. This message will disappear once the user accepts or blocks desktop notifications. This commit is linked to task ID 1838588 and PR #25075.
2018-08-09[IMP] bus: re-factoring of bus.bus (Longpolling and CrossTab)Christophe Matthieu
The purpose of this change is to make the code clearer and testable. In this change, the 'tab_manager' static object was merged with the bus cross tab. Cleaning was done to clearly define private and public functions as well as handlers. The methods are documented and the constants are now defined on the class. The bus use the service behavior with 'trigger_up'. 'bus.CrossTab' who extend 'bus.Longpolling' are instantiated by the bus service. The class is always instantiated with a parent, or root in the case of the website (im_livechat), to use the ajax and localstorage services. So the behavior, perhaps logger or redefined by the parents.
2018-08-09[IMP] web: remove useless service nameChristophe Matthieu
We use the registry keys as name for the services.
2018-07-19[FIX] mail: replace _lt to _t for mailboxes' nameAlexandre Kühn
Since mailboxes are added after the rpc 'mail/init_message', the translations are loaded. Therefore it is not necessary to lazily load the translations.
2018-07-19[FIX] mail: group mail failures of channelsAlexandre Kühn
Before this commit, mail failures were correctly grouped in the systray messaging menu, except for mail failures coming from channels. This commit fixes grouping for mail failures from channel.
2018-07-19[FIX] mail: detach chat threads on receiving a new message only if thread is ↵Alexandre Kühn
detached When a new message is received and discuss is not open, any chat thread containing this message is detached. However, if the thread is already detached, it should not be detached again.
2018-07-19[FIX] mail: re-render thread once on newly added messageAlexandre Kühn
When we add a new message, it should re-render the thread only once. The `addMessage` function must handles new messages and updated messages. Some code for updated messages should not be executed for new messages, which is what this commit does.
2018-07-19[FIX] im_livechat,mail: clean thread models and windowsAlexandre Kühn
- Cleaning website livechat window so that some behaviour are in website livechat instead. - More shared code in abstract thread / abstract thread windows, thanks to the introduction of website_livechat model.
2018-07-19[IMP] mail, *: template rendering with abstract thread, adapt thread ↵Alexandre Kühn
instantiation, thread `getMessages`/`fetchMessages`, and create mode document thread. * = im_livechat, im_support - thread widget now uses abstract thread in `render` method - thread models have their `init` parameters changed, so that the parent may be optional - reworked 'creating a new record...' in chatter in create mode: > new model CreateModeDocumentThread, which basically is a fake document thread with a fake message for its rendering in create mode of the chatter > special rendering method of thread_widget for such case: `renderChatterCreateMode` - renamed thread methods previously named `getMessages` to `fetchMessages`: > in order to not conflict with `getMessages`, used for rendering > now, `getMessages` always get messages that are locally, while `fetchMessages` may fetch messages. TODO: - special thread model for im_livechat (rendering is broken ATM)
2018-07-02[IMP] mail: open document threads in thread windowsAlexandre Kühn
Also roughly called "open chatter in chat windows". With this commit, document threads can now be detached in a small thread window. It uses client-side cross-tab window synchronization by means of the local storage. To detach a document thread in a thread window, click on the document thread preview in the systray messaging menu when receving a new (needaction) document thread message. ------------------------- Technical Limitations ------------------------- 1. In order to use this feature, the user must select the Notification Management 'Handle with Odoo' in the Preferences of the User settings (top-right menu). 2. For the moment, only needaction messages automatically updates the thread window. Manual refresh is still needed for other kinds of messages (e.g. reload document record to fetch new messages in the document thread). Server-side code changes are required to receive new document thread message notifications on the longpoll bus, which would fix the limitations above. ------------------------- Future Works ------------------------- 1. Receive any new message from the document thread window when it is detached. 2. Log a note from the document thread window. Task-33118
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-06-28[MERGE] forward port branch saas-11.3 up to 3cdcbce93cbChristophe Simonis
2018-06-27[MERGE] forward port branch saas-11.2 up to 12ddec3a767Christophe Simonis