<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/mail/static/src/js/chat_window.js, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[REF] mail: JS mail refactoring</title>
<updated>2018-07-02T13:06:54+00:00</updated>
<author>
<name>Alexandre Kühn</name>
<email>aku@odoo.com</email>
</author>
<published>2018-06-12T13:46:46+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=cd34f6de727d5b3858420cff3c9d3c5995c4e75c'/>
<id>cd34f6de727d5b3858420cff3c9d3c5995c4e75c</id>
<content type='text'>
----------------------
 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  &lt;------&gt;  Thread &lt;-------&gt; 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:

        &gt; 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.
        &gt; 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.

        &gt; due to notifications on the longpoll bus for document thread
          messages that come from needaction notifications.
        &gt; 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' &gt; 'close' &gt; 'open')

        Explanation after investigation:

          &gt; 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.

          &gt; The flicker didn't occur before refactoring because the web client was only
            updating the model of channel when it receives the longpoll notification.
          &gt; Server behaviour on 1st longpoll notification is necessary for cross-tab
            synchronization for channel window state.
          &gt; New design implies that model and view should be synchronized, hence the
            issue now.
          &gt; 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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
----------------------
 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  &lt;------&gt;  Thread &lt;-------&gt; 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:

        &gt; 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.
        &gt; 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.

        &gt; due to notifications on the longpoll bus for document thread
          messages that come from needaction notifications.
        &gt; 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' &gt; 'close' &gt; 'open')

        Explanation after investigation:

          &gt; 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.

          &gt; The flicker didn't occur before refactoring because the web client was only
            updating the model of channel when it receives the longpoll notification.
          &gt; Server behaviour on 1st longpoll notification is necessary for cross-tab
            synchronization for channel window state.
          &gt; New design implies that model and view should be synchronized, hence the
            issue now.
          &gt; 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.
</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch 11.0 up to 8dade01e2c5</title>
<updated>2018-05-04T14:10:50+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2018-05-04T14:10:50+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=ac63dfc8f48fa6451b4ef94e24e784f252b84f8e'/>
<id>ac63dfc8f48fa6451b4ef94e24e784f252b84f8e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] mail: Do not close chat widnow if ESCAPE key is pressed on document viewer and keep focus on chat window input when document viewer is closed (#22741)</title>
<updated>2018-05-03T13:16:56+00:00</updated>
<author>
<name>Akash Bhavsar</name>
<email>abh@odoo.com</email>
</author>
<published>2018-05-03T13:16:56+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=8b7fb9a764143946c21548fb4475156238294e0f'/>
<id>8b7fb9a764143946c21548fb4475156238294e0f</id>
<content type='text'>
If document viewer is opened from chat window and when document viewer is opened then focus 
remains on it's modal, pressing escape should set focus back to chat window's input element,

if file selecor dialog is opened and if user press ESCAPE on file selector dialog to cancel file selector 
dialog then it should not close chat window instead it should set focus on chat window input and on 
second ESCAPE key chat window should be closed
also increase z-index of document viewer dialog so image remain on top of cht window

OPW: 1777937</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If document viewer is opened from chat window and when document viewer is opened then focus 
remains on it's modal, pressing escape should set focus back to chat window's input element,

if file selecor dialog is opened and if user press ESCAPE on file selector dialog to cancel file selector 
dialog then it should not close chat window instead it should set focus on chat window input and on 
second ESCAPE key chat window should be closed
also increase z-index of document viewer dialog so image remain on top of cht window

OPW: 1777937</pre>
</div>
</content>
</entry>
<entry>
<title>[REF][IMP] *: mail js refactoring</title>
<updated>2018-02-01T13:51:58+00:00</updated>
<author>
<name>Aaron Bohy</name>
<email>aab@odoo.com</email>
</author>
<published>2017-12-21T11:29:50+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=02ec09cb1c3e2d7bc7968f40c18f2208d7f3f498'/>
<id>02ec09cb1c3e2d7bc7968f40c18f2208d7f3f498</id>
<content type='text'>
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'.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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'.
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web,*: config: add XXS size to config.device</title>
<updated>2018-01-26T18:26:03+00:00</updated>
<author>
<name>Aaron Bohy</name>
<email>aab@odoo.com</email>
</author>
<published>2018-01-04T15:17:14+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=cf178a2f068acd4b4c4fc2cda00b6ef8f6dc79c0'/>
<id>cf178a2f068acd4b4c4fc2cda00b6ef8f6dc79c0</id>
<content type='text'>
In Less, the size_class XXS is defined and used in media queries.
This rev. adds it in JS for sake of consistency.

Code in addons comparing the size_class needed to be adapted due
to the new XXS size_class.

Moreover, we now use the helper 'config.device.isMobile' everywhere
we should, instead of manually comparing the size_class.

Finally, we changed the way the config.device has to be specified
in the test environment. From now on, only the size_class should be
set, and the isMobile flag is computed automatically.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In Less, the size_class XXS is defined and used in media queries.
This rev. adds it in JS for sake of consistency.

Code in addons comparing the size_class needed to be adapted due
to the new XXS size_class.

Moreover, we now use the helper 'config.device.isMobile' everywhere
we should, instead of manually comparing the size_class.

Finally, we changed the way the config.device has to be specified
in the test environment. From now on, only the size_class should be
set, and the isMobile flag is computed automatically.
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] mail: livechat: send message with chat_window</title>
<updated>2018-01-26T10:14:01+00:00</updated>
<author>
<name>Alexandre Kühn</name>
<email>alex.e.kuhn@gmail.com</email>
</author>
<published>2018-01-26T09:58:16+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=1a7a0ec4b330f19a307ef3a29df5aa9515d37c65'/>
<id>1a7a0ec4b330f19a307ef3a29df5aa9515d37c65</id>
<content type='text'>
Revision on c778de44c7cd9b7ef5a9a91738164ab0ebd0ca06
The changes on chat_window are wrong, because the
composer uses an 'input', instead of a 'div'.

As a result, it was not possible to send messages
over im_livechat from the website.

This was not the case on the webclient: chat_window
is enhanced with extended_chat_window, which replaces
the composer with 'div', hence the changes are correct.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Revision on c778de44c7cd9b7ef5a9a91738164ab0ebd0ca06
The changes on chat_window are wrong, because the
composer uses an 'input', instead of a 'div'.

As a result, it was not possible to send messages
over im_livechat from the website.

This was not the case on the webclient: chat_window
is enhanced with extended_chat_window, which replaces
the composer with 'div', hence the changes are correct.
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] mail : display mentions in green color in edit mode</title>
<updated>2018-01-25T11:18:10+00:00</updated>
<author>
<name>Nikunj Ladava</name>
<email>nla@odoo.com</email>
</author>
<published>2017-05-19T12:18:45+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=c778de44c7cd9b7ef5a9a91738164ab0ebd0ca06'/>
<id>c778de44c7cd9b7ef5a9a91738164ab0ebd0ca06</id>
<content type='text'>
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 &lt;a&gt;...&lt;/a&gt; inside.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;a&gt;...&lt;/a&gt; inside.
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web, mail, base: config's `isMobile` definition</title>
<updated>2017-09-29T12:41:41+00:00</updated>
<author>
<name>qsm-odoo</name>
<email>qsm@odoo.com</email>
</author>
<published>2017-09-29T12:04:48+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=87f1e360a89eb7617d5fd60cad58a143bea441df'/>
<id>87f1e360a89eb7617d5fd60cad58a143bea441df</id>
<content type='text'>
The `isMobile` variable was defined at the right place (`config.device`)
but was set at the wrong place (`config`).

Thank you for making me author of all the `isMobile` lines by
the way... :)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `isMobile` variable was defined at the right place (`config.device`)
but was set at the wrong place (`config`).

Thank you for making me author of all the `isMobile` lines by
the way... :)
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] mail: make clicking on chat window's emoji button properly work</title>
<updated>2017-09-20T13:03:56+00:00</updated>
<author>
<name>qsm-odoo</name>
<email>qsm@odoo.com</email>
</author>
<published>2017-09-18T14:20:19+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=26e079f246c196bc08669db3894c8b2c83cc2639'/>
<id>26e079f246c196bc08669db3894c8b2c83cc2639</id>
<content type='text'>
Before this commit, clicking on the button opened the emoji popover
then closed it immediately. This was because of a handler which said
that clicking on any part of the composer should focus the input
element. This is indeed required when the UI is blocked (thanks to
the `blockUI` function). Solution is to not force this focus when
clicking on any composer's button element.

To prevent breaking those two behaviors (blockUI focus and emoji), two
tests were implemented.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit, clicking on the button opened the emoji popover
then closed it immediately. This was because of a handler which said
that clicking on any part of the composer should focus the input
element. This is indeed required when the UI is blocked (thanks to
the `blockUI` function). Solution is to not force this focus when
clicking on any composer's button element.

To prevent breaking those two behaviors (blockUI focus and emoji), two
tests were implemented.
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] im_livechat, mail: Discuss UI in mobile</title>
<updated>2017-09-15T13:25:06+00:00</updated>
<author>
<name>Aaron Bohy</name>
<email>aab@odoo.com</email>
</author>
<published>2017-09-15T09:28:13+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=7a91d87614f9a72df1d81ee28a5f425517e9b218'/>
<id>7a91d87614f9a72df1d81ee28a5f425517e9b218</id>
<content type='text'>
- Extract mobile specific code for the client action to a specific
  file
- Massive clean of less rules
- Unify channels preview of the systray dropdown and the mobile UI
  of Discuss
- Ensure to only load the last message of each channel in mobile,
  as this is not used in desktop (unless the user opens the systray
  menu)
- Make livechat available in Discuss mobile UI
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Extract mobile specific code for the client action to a specific
  file
- Massive clean of less rules
- Unify channels preview of the systray dropdown and the mobile UI
  of Discuss
- Ensure to only load the last message of each channel in mobile,
  as this is not used in desktop (unless the user opens the systray
  menu)
- Make livechat available in Discuss mobile UI
</pre>
</div>
</content>
</entry>
</feed>
