summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/models/threads/mailbox.js
AgeCommit message (Collapse)Author
2020-06-15[REF] mail, *: refactor messaging with OWLSébastien Theys
This commit is a significant rewriting of client-side discuss, chatter, chat window, and messaging menu using OWL. The behavior should be broadly the same, with some slight functional changes here and there. From a technical standpoint, the code of messaging is mainly organized in 2 main groups of modules: - models, which are logical entities that depict the client-side state of messaging as a whole. - components, which are in charge of displaying information from models. This refactoring also introduces new JS guidelines regarding folder structure (/static) and naming rules for JS modules. Community PR: https://github.com/odoo/odoo/pull/39023 Enterprise PR: https://github.com/odoo/enterprise/pull/6249 Task-1914207 This PR is a collaborative work by Alexandre, Julien, Sébastien and Xavier, with the precious help of Lucas to speed it up towards the end. closes odoo/odoo#39023 Related: odoo/enterprise#6249 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Alexandre Kühn <aku@odoo.com> Co-authored-by: Julien Giannone <jgi@odoo.com> Co-authored-by: Lucas Perais <lpe@odoo.com> Co-authored-by: Sébastien Theys <seb@odoo.com> Co-authored-by: Xavier Dubuc <xdu@odoo.com>
2020-02-18[FIX] mail: no crash on receiving needaction on messaging not readyAlexandre Kühn
Before this commit, when receiving a needaction message while messaging was not ready (i.e. `/mail/init_messaging` not resolved), the web client crashed with the following error message: ``` TypeError: Cannot read property 'incrementMailboxCounter' of undefined ``` This happens due to reception of needaction message incrementing counter of mailbox Inbox, but this mailbox is only added after messaging is ready. This commit fixes the issue by directly adding inbox mailbox on starting the mail service. closes odoo/odoo#45442 X-original-commit: 741acb9f48f2d3542549791a8fd7d6fb318bc862 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-08-05[IMP] mail, test_mail: new 'History' mailbox in DiscussNikunj Ladava
This commit adds a new mailbox in the Discuss app called 'History'. Messages that have been marked as read are moved to 'History'. Notifications are required to link history messages to users. So notifications are now deleted after they are more tha 6 months old. This means History mailbox keeps less than 6 months old messages. Note that this feature only works when user notifications are handled in Odoo. This can be set in the user preferences, under the "Notification Management" section. Task-ID 402597
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>
2018-11-26[FIX] mail: reply message from inboxAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/cd34f6de727d5b3858420cff3c9d3c5995c4e75c Before the commit above, it was possible to reply to a message from Inbox. Those messages were linked to a document, and replying to any of them put a response in the related document. This feature has been broken since the commit above: the reply icon was only shown on messages linked to a channel, instead of message linked to a document. Also, it was erroneously prompting that the message was sent to the channel, even though it was not the case. This commit fixes the issue by toggling the visibility of the reply icon, so that it is shown only for messages that come from a document. Also, since posting a message requires a thread, this commit added the possibility to post a message from a mailbox, which instead posts the message to the related document thread. Task-ID 1912647 closes odoo/odoo#29028
2018-11-14[FIX] mail: no crash on grouped inbox messages previewsAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/5f8d3c61bee40d027efc5041cdc4bca5e67c42d7 Before this commit, there was a traceback when you had two needaction notifications related to the same document. This is caused by a typo in the commit above: the object `similarItem` has a property `messageIDs`, but the code wrongly access the property `messagesIDs` (see the extra "s"). Steps to reproduce: - Set notification management to 'Handle with Odoo' for Admin - Demo mention Admin twice on a specific project task - Admin opens messaging menu Display error `Cannot read property 'concat' of undefined` Issue reported on this PR comment: https://github.com/odoo/odoo/pull/28462#pullrequestreview-175001349 Task-ID 1909521 closes odoo/odoo#28703
2018-11-07[FIX] mail: mark as read per previewAlexandre Kühn
Before this commit, when there was several previews on the messaging menu that were not linked to any document, marking one of them as read had the unintended behaviour to mark all of them as read. Steps to reproduce: - Admin with notification management as 'Handle with Odoo' - Demo assign Admin to two different tasks - Admin mark one preview as read > Both previews notifying assignment to a task have been marked as read This is caused by the fact that messages of those previews are not related to any document. As a result, when marking one preview as read, it maps related messages to mark as read, which was taking into account all messages that are not related to any document. With this commit, previews now tracks message IDs, so that marking one preview as read only mark the related messages as read. Task-ID 1907159
2018-09-12[FIX] mail: filter messages in thread (Discuss)Alexandre Kühn
Revision on https://github.com/odoo/odoo/commit/ec8c505bc1c9ec21939e9ffef53a9cc6f63f30c7 The commit above changes the way threads are rendered: the template now uses a thread object, instead of a list of messages. However, it was not handling messages that have been filtered from the searchview. As a result, it was not possible to filter messages at all. This commit re-adds the possibility to filter messages, by providing information on the domain of the thread in the template. Task-ID 1877502
2018-08-30[REF] mail: clean some JS codeAlexandre Kühn
1. Removed `getLocalMessages` method in mailbox, and replaced with an override on `getMessages`. (This method was used before the distinction was made between `getMessages` and `fetchMessages`) 2. Removed unused method `_warnUpdatedUnreadCounter` in abstract thread window. (Leftover from an early POC) 3. Set the default value `''` for the status of a thread. (The method `getStatus` should always return a string) 4. Enforce default value `false` for detached status of channel. (The method `isDetached` should always return a boolean) 5. Improve readability of some tests. (removed useless variables and/or redundant code)
2018-08-27[FIX] doc building and warningsXavier Morel
doc: * fix incorrect doc comments (documenting params which don't exist) * correctly quote non-refs * fix role label syntax (backticks must be escaped) * add newline to fix warning JS doc parser: * fix handling of already-resolved objects * fix handling of non-string properties (e.g. foo[0] at module toplevel) * don't blow up if subject of .include call can't be resolved (just ignore) Others: * add translator support for ``problematic`` node (apparently used for some refs by recent Sphinx)
2018-08-17[FIX] mail: misplaced translatable stringAlexandre Kühn
`_t()` must surround a static string in order to become a translatable string.
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-07-19[FIX] mail: clean docstringAlexandre Kühn
- updated docstring - move function to abstract thread (generalization behaviour for all threads) - simplify code
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-19[MOV] mail: move thread models in specific folder for thread modelsAlexandre Kühn
The `model` folder contains several files, so this groups files related to threads directly.