Commit Graph
3 Commits
Author SHA1 Message Date
Alexandre Kühn f0f81e8db3 [FIX] mail: correctly handle (non-)passive thread windows
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-30 13:30:12 +02:00
Alexandre Kühn be44efe852 [REF] mail: clean some JS code
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-30 13:26:07 +02:00
Alexandre Kühn eee49f13f0 [FIX][REF] mail: several thread windows fixes
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-27 18:32:58 +02:00