summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/chatter.js
AgeCommit message (Collapse)Author
2019-04-10[MERGE] forward port branch saas-12.2 up to 2694174b410Christophe Simonis
2019-04-05[FIX] mail: reload the record when uploading attachments if post_refresh is ↵Nans Lefebvre
set to always When post_refresh is set to 'always', the displayed record is entirely reloaded each time a message is posted in the chatter. However no such thing exists for when attachments are uploaded. This is of use e.g. when in the view there are fields that have attributes that depend on computed fields, themselves dependent on the record's attachments. One such case is the OCR. opw 1950403
2019-03-22[FIX] *: pass context in kwargs in rpc callsRaphael Collet
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-19[FIX] mail: chatter attachments without threadThanh Dodeur
This fix prevents the chatter and attachment box from assuming that there is a mail_thread on the record; Reason: if a chatter is set on a record that doesn't inherit mail_thread, the attachment box will generate errors. closes odoo/odoo#31206
2019-01-30[FIX] mail: keep record changes on attachment uploadNans Lefebvre
Steps to reproduce: - Edit a record. - Log a note or send a message with an attachment. - Save the record. Bug: changes made to the record are discarded. Because uploading an attachment triggers a reload without 'keepChanges', the record values are read from database. However displayed values are not updated, so there is no feedback that changes have been discarded. On save, the page is reloaded so the user sees that changes have been lost. Introduced by 7f97c9fc056a0949c61c8444ee20f4c95bb3e9a9. opw 1923824 closes odoo/odoo#30642
2019-01-28[IMP] mail: adds delete and upload to chatterThanh Dodeur
backport of 73d9b9588f24788766c66aacd69ed436bb0223f4 This commit adds the ability to upload and delete attachments from the chatter. closes odoo/odoo#30636
2019-01-25[MERGE] forward port branch saas-11.3 up to 387d5cff90bChristophe Simonis
closes odoo/odoo#30566
2019-01-23[MERGE] forward port branch 11.0 up to 984a99611eeChristophe Simonis
2019-01-14[FIX] mail: keep attachments when switching between note and messageNans Lefebvre
Start a message mail (respectively note) in the chatter. Attach a file. Switch to note (respectively mail). The attachment is lost. With this commit, we keep the attachments after the switch. opw 1925588 closes odoo/odoo#30197
2019-01-23[FIX] mail: focus chatter composer on mobilePierre Paridans
Sending a message on the chatter is painful as you need to scroll to see the buttons and click to open the composer. Then again click to set the focus in the composer (making the keyboard appear) and scroll again to be able to write your message. On a view form when clicking on the "New Message" or "Log Note" buttons the focus should be put in the text field, then opening the mobile device keyboard and scroll the view to make the text field visible. NB: in some case on Android (both WebView and Google Chrome) the scrolling is not operated correctly resulting into the text field being hidden behind the keyboard. This issue looks related to some timing between the actual focus() call and the keyboardi appearance triggered by the operating system. Sadly we don't have any control on that part. Related to task 1891955 closes odoo/odoo#29239
2018-11-15[MERGE] forward port branch 11.0 up to 468dab6748aChristophe Simonis
2018-11-08[FIX] mail: enable composer after message sentNicolas Lempereur
c5dc0b2f39 disabled send button on composer sent. But this is only needed for chatter composer, other composers directly send the message and are not refreshed asynchronously. So for other composer, the send button worked one time but then was disabled and the only way to sent was ENTER (on basic composer) or CTRL+ENTER (on extended composer). With this fix, disabling the button is done only for chatter composer. 11.0 backport of 12.0 #28474 issue found when checking opw-1904029 closes #28506
2018-11-09[FIX] mail: enable composer after message sentNicolas Lempereur
c5dc0b2f39 disabled send button on composer sent. But this is only needed for chatter composer, other composers directly send the message and are not refreshed asynchronously. So for other composer, the send button worked one time but then was disabled and the only way to sent was ENTER (on basic composer) or CTRL+ENTER (on extended composer). With this fix, disabling the button is done only for chatter composer. Also the behavior of not clearing the message if there was an error is introduced back. Without change in code, added test fails with: "Should keep unsent message in the composer on failure" (result: "") "Send button should be re-enabled on message post failure" (result: true) issue found when checking opw-1904029 closes #28475
2018-10-17[FIX] mail: chatter in x2many form viewAaron Bohy
Since rev. 755a8d815a, it crashed when the user tried to open an x2many record in form view (thus in a dialog), if there was a chatter in that form's arch. This was because the wrong viewType was used (for instance, list or kanban instead of form), to look into fieldsInfo, and thus the chatter fields couldn't be found. opw 1891378 opw 1892520 opw 1893100 closes odoo/odoo#27844
2018-09-17[REF] mail: update related_attachment_count field name to match mixin namespace.ThanhDodeurOdoo
Reason: The Attachment count of mail_thread is used by the new attachment button of the chatter, the compute field has been chosen over a search_count JS RPC to keep a synchronous chatter and prevent flickering. This commit refactors those changes to follow the naming conventions of mail_thread and to optimize the count method for eventual reuse follwing TDE's advices. - Changed the name of a mail_thread's related_attachment_count into message_attachment_count. - Changed the count method to a read_group. PR: 26989 Task: 1860031
2018-09-13[IMP] mail: new attachment button in the chatterThanhDodeurOdoo
- Added a new button to the chatter that displays the amount of attachments on the current record and when clicked, all the attachments attached to the current record - added mail.FormView (includes), used by the chatter attachment button to fetch the field value of attachment_count. - added a computed field "attachment_count" to mail.thread that contains the amount of attachment attached to the record. - changed the followers div, it is now sharing a "right side" area with the attachment button. task: 1860031
2018-08-20[IMP] mail: refactor activity.js and add some testXavierDo
activity.js was a little dirty with a lot of copy paste. Most of the common logic is now in a BasicModel. This commit also add some tests on activity view Co-authored-by: RomainLibert <rli@odoo.com>
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-13[IMP] mail: Chatter: add 'display_log_button' optionAaron Bohy
This rev. allows to instantiate a Chatter Widget with option 'display_log_button' (which shows the 'Log note' button). This option already existed, but it had to be specified in the nodeOptions (i.e. in the view arch), which is not convenient when a Chatter is instantiated outside the context of a FormView. Part of task 1853490
2018-08-13[IMP] mail: Chatter: allow to instantiate outside FormViewAaron Bohy
2018-07-24[FIX] mail: auto-focus input on open composer in Chatter (touch and ↵Kirti Choudhary
non-mobile devices). Before this commit, when opening the composer in chatter with "Send Message" or "Log note" with a touch and non-moble device (e.g. laptop with touchscreen), the focus was not set on the input automatically. The intent behaviour is to auto-set the focus on non-mobile device, including touch devices. This commit fixes this issue for touch and non-mobile devices. Task-ID 1824035
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-15[FIX] mail: warn user on record reload before post messageAlexandre Kühn
Before this commit, the user could lost some unsaved changes in a record when posting a message in the chatter. This is due to reloading the data on the record, which is necessary because a `message_post` may make some changes on the record [1]. With this commit, a dialog will warn the user that the record will be reloaded in the following cases: a) posting a message in the basic composer that will reload the record b) opening the full-composer when the record is dirty Indeed, any operation after opening the full-composer will always refresh the record (even closing the dialog). Known issues: - a record is not considered as dirty if we only make changes in its description from a pad. > the content of the pad will be erased without any warning... [1] https://github.com/odoo-dev/odoo/commit/803d5cf04835fcf8e7ddb143e1ab140408beef93 opw-1825005
2018-05-16[REVERT] "[IMP] mail : display mentions in green color in edit mode"Alexandre Kühn
This reverts commit c778de44c7cd9b7ef5a9a91738164ab0ebd0ca06.
2018-05-15[FIX] mail: Missing parenthesis to call "remove" on chatter spinnerToufik Benjaa
- The code to remove the loading spinner from the chatter was missing parenthesis to actually do the function call.
2018-02-01[REF][IMP] *: mail js refactoringAaron Bohy
This commit improves the JS code of the mail module, which comes maily from the new coding guidelines and the addition of "JS services". JS services are important objects that do not fit well in the component tree, such as chat_manager or ajax. The benefits of JS services are improved readability of the code, reduced coupling, and more testable modules. In particular, discuss was hard to Summary of the changes: - ClientAction has been renamed into Discuss - Clear instantiation of chatManager - New coding guidelines in most mail modules - JS Services can interact with each other - Chat Manager and Window Manager are services - Window Manager renamed to Chat Window Manager - bus.bus is now encapsulated in Bus Service (a service) - The test infrastructure has been tweaked with JS Services - Chat Mixin has been removed A future improvement would be to translate some 'trigger' into 'trigger_up'.
2018-01-25[IMP] mail : display mentions in green color in edit modeNikunj Ladava
When someone mentions another person in discuss/chat window, the mentioned name was displayed just as a text, which may be unclear. With this commit, we display mentions with the same style as mentions in a message. To do that, the main idea is to change the input by a div with contenteditable set to true. This allows us to add <a>...</a> inside.
2018-01-22[MERGE] forward port branch saas-11.1 up to fa1f2132e79Christophe Simonis
2018-01-19[MERGE] forward port branch saas-16 up to f99c4f2b48bChristophe Simonis
2018-01-19[MERGE] forward port branch saas-15 up to 0c54862cbf1Christophe Simonis
2018-01-17[IMP] mail: chatter creation message in formviewAlexandre Kühn
Before this commit, when we create a new object (e.g. task, product, ...), the part of the form for the chatter was blank. After this commit, it displays the chatter with a single temporary message 'Creating a new record...' This message is only visible by the user that is creating the task, and goes away when saving the newly created task. Any interaction with the chatter (buttons and widgets at the top of the chatter, including the message itself) are disabled, so that no interaction from the user is possible.
2018-01-16[FIX] mail: Cannot send new message from Event TrackGoffin Simon
When the Speaker address is False, it crashed. opw:805361
2017-09-29[FIX] mail: make "Schedule activity" text smaller in mobileqsm-odoo
2017-09-05[REF] mail: review new chatter designqsm-odoo
- Use classes instead of repeated mixins - Add real user avatar instead of fake one - Reorganize LESS rules
2017-09-05[REF] mail: introduce new chatter/discuss designstefanorigano
- Improve overall design - Better use of UI colours - Replace planned activities icon - Vertically align kanban icons - Remove the 'bell shtcut' and followers caret - Use a mixin to style the chatter (inline, not inline, compact)
2017-08-29[FIX] web,mail: keep changes when scheduling an activityAaron Bohy
The problem occurred in form view, in edit mode, when the user did some changes in the form, and then clicked on 'Log or schedule an activity'. When validating the activity, the fields mail_activity and mail_thread were reloaded but all changes were discarded in the process. This rev. ensures to reload the requested field without discarding the changes.
2017-06-01[MERGE] Forward-port 10.0 up to 7e44444878760ca44cf1b22bf05d77e26c477cabOlivier Dony
2017-05-24[FIX] mail: can't open mail composer on virtual eventNicolas Lempereur
In the case of a chatter on a calendar virtual event, there was a number of issue because the record ID was of the type "[REAL ID]-[VIRTUAL ID]". This caused issue when fetching and posting message with the composer. opw-744405 closes #17179
2017-05-04[IMP] mail: add view reload option on chatterThibault Delavallée
Purpose is to be able to reload the view after posting a message using the chatter. Reason behind that move is that records can be updated after processing message_post and this is the easiest solution to enable the reload feature without having an event-based chatter.
2017-04-24[ADD] mail: re-introduce recommended next activitySiddharth Gajjar
Activities now have recommended next activities. Based on next activities configured on activity types, it allows to implement light workflows using next activities feature. This feature was removed when refactoring crm activities to generic activities. People asking to remove it were visibly wrong and it is now implemented back as it was in v10.
2017-04-11[FIX] web,mail: one2many records: multiple viewsAaron Bohy
A record of the basic model may need to be displayed in different views (e.g. a o2m record is displayed in the, e.g., Kanban view inside the main form view, and if clicked, it is also displayed in the form view opened in a dialog). However, the fields present in those views may differ. The previous implementation of fieldsInfo in the record didn't handle that, as it was a dict whose keys were field names. With this commit, the fieldsInfo is dict whose keys are view types, and the values are dicts whose keys are field names (the fields of the corresponding views, with they attrs in the view). This allows to create multiple o2m records in a row in a form view.
2017-04-11[FIX] mail: activity feedback: port odoo/odoo@63167fc5Aaron Bohy
to the new views
2017-04-11[REF] web, *: simplify our RPC system (in JS)Géry Debongnie
The RPC system was not completely satisfactory, we decided to prepare the future and do it properly. This commit introduces the new rpc system, which replace the previous new one. We now simply have a method, this._rpc, which takes a dictionary of parameters. The idea is that depending on the parameters, it is able to add correct default value when necessary. For situations where we don't have the this._rpc method, we can use the rpc.query method, which takes the same arguments, but directly calls ajax.rpc instead of triggering up some events.
2017-04-11[REF] web: change internal representation of fields and view meta datasChristophe Matthieu
* Data manager load_view returns a viewInfo object * ViewInfo contains: the arch, fields and fieldsInfo objects, and some extra informations * The fields come from the server and are frozen, without any view attributes (depend of the model). * The fieldsInfo contains every view attributes and informations.
2017-04-11[REF] web, mail: include evaled field options in datapointqsm-odoo
Field options do not depend on any context/data. They can so be "computed" once and for all in the BasicView implementation instead of in the AbstractField's one. Also, remove the flag __always_reload and leave it be in the options object (always_reload).
2017-04-11[REF] *: use _rpc method for all rpcsGéry Debongnie
The _rpc method is now the preferred method to do a rpc, so we need to update all calls.
2017-04-11[REF] web,*: remove 'web.model' and 'web.dataModelGéry Debongnie
Use this.rpc instead of Model object, with web.ajax if necessary. nb: EventDispatcherMixin include now the custom_events managment instead of widget
2017-04-11[REF] web, *: redesign all JS viewsGéry Debongnie
This commit introduce a full redesign of all JS views. We started basically from scratch. The goal was to unify all the various views under a common framework, to make them testable, to make then usable in different conditions (in studio, or in the frontend), and to make our lives easier. Some important points are: - we introduced new coding guidelines (camelCase, 80 chars width, ...) - we have a brand new testing framework (still QUnit based) - kanban view moved to the web addon - calendar view (formerly web_calender) moved to web as well - the tree view was removed - all new code should be documented We hope that this code is the start of a new era for the Odoo web client, we want to have a high quality codebase, well documented, well tested, well designed. Work done by the framework team: mostly aab, ged, chm, dmo, qsm
2017-02-23[MERGE] forward port branch 10.0 up to 387b2acfcbfChristophe Simonis