Commit Graph
2976 Commits
Author SHA1 Message Date
Christophe Simonis 639bd89635 [MERGE] forward port branch saas-11.3 up to 94a9fc9902 2018-11-08 17:08:03 +01:00
Nicolas Lempereur 9799dd294d [FIX] mail: enable composer after message sent
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-11-09 08:10:24 +00:00
jev b5885f0cb0 [FIX] mail: popover email icon without any customer email data
Before this commit, when hovering on a email icon of a message
in chatter without any customer email data, there was a crash
with the following error message:

"No enumerator given to foreach"

This was caused by `undefined` being passed to `t-foreach` when
there are no customer email data on the message. Since
`undefined == null`, it raised the error above.

closes odoo/odoo#31587

Signed-off-by: =?utf-8?b?QWxleGFuZHJlIEvDvGhuIChha3Up?= <aku@odoo.com>
2019-03-05 11:30:42 +00:00
Nicolas Lempereur 05533ceda6 [FIX] mail: link mention if it is still working
In some special instance, a mention could get linked and the user would
not really be linked.

This is because of a difference between linking the mention and adding
the user as follower that required a space after the mention.

With this change:

- `[adding mention]@admin [backspace].`: was linked but not added as
   follower => now it is not linked either.
- `[adding mention]@admin [backspace][enter][adding mention]@admin `:
   the first @admin was linked => now the second is linked

Without the change, added test fails with:

 "should not contain a link in the message content"
 "should not have linked mention without space"

opw-1934946
closes #31433
2019-02-26 14:46:25 +00:00
Christophe Simonis f6ca72b3ce [MERGE] forward port branch saas-11.3 up to 21eb31d804 2018-10-31 20:43:03 +01:00
Christophe Simonis 21eb31d804 [MERGE] forward port branch 11.0 up to a587325ca7 2018-10-31 19:22:21 +01:00
Nicolas Lempereur 81b6adcda7 [FIX] mail: traceback reply button typo cd34f6de72
There was a typo with msgID at one part called messageID in another.

opw-1904029
closes #28465
2018-11-07 10:38:14 +00:00
Pierre Paridans dd70c68426 [FIX] mail: content override toolbar in mobile landscape
On mobile (specifically in landscape orientation as the height of the
viewport is narrower), the content appear over the bottom toolbar
instead of going below.
Solution is in 2 parts:
* raise the toolbar way above the content
* make the toolbar opaque

closes odoo/odoo#28429
2018-11-06 13:06:16 +00:00
Christophe Simonis ca3a1f51d8 [MERGE] forward port branch saas-11.3 up to 4f3a20bb33 2018-10-30 11:45:18 +01:00
Alexandre Kühn 91dfb15c3c [FIX] mail: mark as read only when accessing to chatter
Backport of 17bb0ca443

Before this commit, the user could not receive any notification
from the chatter of a document when having Notification Management
set to "Handle with Odoo".

This problem occurs when the user opens (or has opened) the document.
Any messages received from the document are automatically marked
as read, so it removes the notification right after receiving it.

In order to no longer have this issue, the user had to reload all
pages that have opened this document.

This commit slightly changes the behaviour of the chatter, so that
it automatically marks it as read only when accessing the document,
but not when the document is open (or has been opened). Consequently,
if the user has opened the document and then receives a notification
from this document, it won't automatically mark it as read.

Task-ID 1895359

opw-1890556

closes odoo/odoo#28113
2018-10-29 17:52:05 +00:00
Christophe Simonis 8cf43f1350 [MERGE] forward port branch 11.0 up to ee0ff262f0 2018-10-29 17:12:53 +01:00
Christophe Simonis ee0ff262f0 [MERGE] forward port branch saas-15 up to 953dfe92c2
closes odoo/odoo#28255
2018-10-29 14:16:45 +00:00
Christophe Simonis d692f3b781 [MERGE] forward port branch saas-14 up to 1916fdc1d0 2018-10-29 13:46:47 +01:00
Christophe Simonis 1916fdc1d0 [MERGE] forward port branch 10.0 up to ac08e2ba53 2018-10-29 12:27:14 +01:00
Olivier Colson ac08e2ba53 [FIX] mail: display both tracking values and body of the messages in mail thread
Before that, the body of the message was never displayed if the message had tracking values. This was annoying for account_asset module, were we prompt the user for some justification when she modifies the depreciation data of an asset, and then call message_post with this text as body, and tracking values reflecting the change that was made.
2018-10-26 11:37:52 +02:00
Julien (juc) Castiaux c5dc0b2f39 [FIX] mail: spam the send button create multiple messages
Spamming the "send" button on the chatter send multiple times the
same message. This PR simply disable the send button to fordib the
spam.

opw-1895511

closes #27233

closes odoo/odoo#28078
2018-10-26 09:29:57 +00:00
Martin Geubelle 8b9cb0565e [FIX] mail: remove mail_followers widget support claim
This widget claims to support one2many fields but it doesn't work in most cases.
This was triggering warnings when this widget was set on another field or in another
view (i.e. in Studio).

opw-1905803

closes odoo/odoo#28413
2018-11-05 15:20:54 +00:00
Christophe Simonis 5e055a2afd [MERGE] forward port branch saas-11.4 up to f6ca72b3ce 2018-11-02 10:52:55 +01:00
Alexandre Kühn 17bb0ca443 [FIX] mail: mark as read only when accessing to chatter
Before this commit, the user could not receive any notification
from the chatter of a document when having Notification Management
set to "Handle with Odoo".

This problem occurs when the user opens (or has opened) the document.
Any messages received from the document are automatically marked
as read, so it removes the notification right after receiving it.

In order to no longer have this issue, the user had to reload all
pages that have opened this document.

This commit slightly changes the behaviour of the chatter, so that
it automatically marks it as read only when accessing the document,
but not when the document is open (or has been opened). Consequently,
if the user has opened the document and then receives a notification
from this document, it won't automatically mark it as read.

Task-ID 1895359

opw-1890556

closes odoo/odoo#28114
2018-10-26 08:39:39 +00:00
Adrien Dieudonne ee622b9b66 [FIX] mail: schedule an activity button not visible in mobile
Before this commit, text color was in grey because of a css
inherited rule applied by Bootstrap when there is no href attribute.
In mobile, text color was in white as the background and it was not
possible to see the text.

Now, we transform this link into button to restore the previous
behavior and keep it visible in mobile.

closes odoo/odoo#28061
2018-10-23 11:43:05 +00:00
Mohammed Shekha 10cf85e4c5 [FIX] mail: ignore popover if bootstrap not available
Before this commit, there may be a silent crash when accessing the
livechat from the customer URL, e.g.
`http://mycompany.odoo.com/im_livechat/support/1`.

This issue occurs when bootstrap popover lib is not available.
This does not occur if one tab of the current browser has this lib
loaded. To reproduce this issue, open the customer URL from another
browser:

1. Access to `/web` from any browser (e.g. Chrome)
2. Go to Live Chat app
3. Select a livechat channel
4. Go to sheet page "Widget"
5. Copy text of the customer URL (2nd "Copy Text")
6. Paste the URL in a different browser (e.g. Firefox)
7. Open the livechat menu
8. Inspect dev tools

=> It will complain that `popover` is not a function.

We would like to keep the livechat lib as small as possible,
so instead of importing the boostrap lib, we simply prevent
the logic that generates the issue.

Task-ID 1885445
2018-10-19 09:07:24 +00:00
Alexandre Kühn 5a552f0302 [FIX] mail: auto-follow on message post
Before this commit, there was the following issue
in the chatter:

- on document with customer field set;
- open the composer;
- post a message with suggested partner checkbox set;

=> the partner is not added as a follower of the document

This was caused by a typo when refactoring the JS of the
module mail.

Task-ID 1896010
Closes #27864

closes odoo/odoo#27932
2018-10-18 09:24:53 +00:00
Aaron Bohy bd004ac75e [FIX] mail: chatter in x2many form view
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-10-17 08:44:49 +00:00
Alexandre Kühn 7b91a6483a [FIX] mail: simplify channel domain for message_fetch
It was simplified by https://github.com/odoo/odoo/commit/84af9382e2315964209bb065945b5d9116ddb11a
but the forward-port somehow failed.
2018-10-16 07:29:08 +00:00
Alexandre Kühn d3ceaa3adc [FIX] mail: improved message_fetch for moderated channels
There was two issues with the previous code:

	1. It was using a weak heuristic to determine whether the
	   current thread is a channel (ID is a number)
	2. For any channel, it was always passing `moderated_channel_ids`
	   with some values to the server, even though the channel
	   is not moderated at all.

This commit solves both issues by passing `moderated_channel_ids`
only for moderated channel. Also, this logic has been moved from
SearchableThread to Channel, since moderation makes only sense for
channels and channels are aware of whether they are moderated or
not.
2018-10-16 07:29:08 +00:00
Alexandre Kühn c0c2590a40 [FIX] mail: no moderation in chat window
Before this commit, a moderator of a moderated channel could see
commands on 'pending moderation' messages in a chat window, although
none of them work in chat windows.

Those commands only work in Discuss. Making them work in chat windows
is not trivial, because some code must be redesigned for this.

This commit disables moderation commands in chat window. Moderators
of such channel now see 'Pending moderation' on such messages in
chat window, and mouse-hovering on this annotation tells the user
to moderate those messages in the Discuss app.

Task-ID 1887963
2018-10-16 07:29:07 +00:00
Alexandre Kühn 510065ab67 [FIX] mail: remove outdated parameter in static xml comment 2018-10-16 07:27:44 +00:00
Nicolas Lempereur dbe0337555 [FIX] mail: mention escape let original intact
When selecting a mention we will add a mention in a list of selection
from the list of mention.

In 10f0766b3 that mention in list of selection was escaped so this would
match the text that would be escaped when the mention was searched in
it.

But the object are the same so the change modified the original list.

Modified test failed with:

```
  10. first partner mention should still display the correct partner
      name (Expected: "ЅpëciãlUser<&>\"`' ツ" Result:
      "ЅpëciãlUser<&>\"`' &lt;&amp;&gt;&quot;&#x60;&#x27; ツ")
```

opw-1909300
closes #29098
2018-11-28 12:33:17 +00:00
Alexandre Kühn 6f37e2cc5d [FIX] mail: increment messaging menu counter once per unread preview
Before this commit, the total amount of unread messages of a
channel was considered in the computation of the messaging
menu counter.

As a result, if the channel contains 100 unread messages,
the messaging menu was displaying a counter of more than 100.

The intended behaviour is to increment the messaging menu
counter once per unread channel, thus the example above should
incremented the counter only once. The channel preview itself
should still display that there are 100 unread messages.

Task-ID 1913080

closes odoo/odoo#29080
2018-11-27 15:06:23 +00:00
Alexandre Kühn 9df8e88046 [FIX] mail, test_mail: make mail_tour work
This tour was broken since the following refactoring:
https://github.com/odoo/odoo/commit/cd34f6de727d5b3858420cff3c9d3c5995c4e75c

With this commit, mail_tour should work correctly, and
is automatically run on runbot.

Note that the tour is automatically run in the module `test_mail`,
so that the tips are not displayed by installing Discuss.

Task-ID 1912730

closes odoo/odoo#29040
2018-11-26 16:26:34 +00:00
Alexandre Kühn 6f7a04be0b [FIX] mail: reply message from inbox
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-26 14:12:50 +00:00
Alexandre Kühn c45c5bb411 [FIX] mail: messaging menu show undated DM previews last
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-26 08:51:34 +00:00
Alexandre Kühn 341fb5f240 [FIX] mail: no '#' prefix in DM name
Before this commit, DMs had the prefix '#' in their
displayed name (e.g. '#Demo User').

This commit fixes the issue by putting this prefix
only on non-chat DMs. In particular, mailboxes, DMs
and Livechats no longer show this prefix. This change
is also visible in the breadcrumb of the discuss app.

Task-ID 1911738
2018-11-26 08:47:36 +00:00
qsm-odoo 39fb86a352 [FIX] web, *: remove useless mixin
* mail
2018-10-02 17:29:30 +02:00
Alexandre Kühn e8a071a744 [FIX] mail: show/hide 'New Message/Channel' in discuss mobile
Before this commit, the buttons 'New Message' and 'New Channel'
were shown in all tabs of discuss mobile, even though they should
only be displayed in some tabs.

This issue comes from a change from BS3 to BS4, in which the classname
`visible-xs` has been replaced with `d-block d-md-none`. With BS4,
the classnames `d_*` are now `!important`. As a result,
`d-block d-md-none o_hidden` still displayed the button because
`o_hidden` does not have `!important`.

This commit fixes this issue by removing the reliance on `o_hidden`,
and now only uses `d-*` for the visibility of the button. The toggling
of `o_hidden` has been replaced with adding or removing the classes
`d-none` (hidden) and `d-block` (visible). Those buttons are not shown
in desktop thanks to `d-md-none`.

Task-ID 1877502
2018-10-01 18:19:48 +02:00
Christophe Simonis 453e81cdc8 [FIX] mail: used defined variable
Oversight of previous forward-port.
2018-10-01 17:04:22 +02:00
Christophe Simonis 43b63a0465 [MERGE] forward port branch saas-11.4 up to 57e387b645 2018-10-01 16:01:54 +02:00
Thibault Delavallée 0e3d5941da [FIX] mail: also find escaped heart <3 emojis
Otherwise <3 is not correctly translated into :heart which makes a lot of
people very very sad.

Commit linked to task ID 1887949.
2018-09-25 14:44:45 +02:00
Alexandre Kühn 3457e037e9 [FIX] mail: mark document thread preview as read
Before this commit, it was not possible to mark a document
thread preview as read from the messaging menu.

This issue comes from the fact that document message previews
are built from messages in the Inbox. The computation of
the unread counter is correct for the preview, but not for
the associated document thread object which has a counter of 0.
Since it is only possible to mark as read when the counter is
strictly greater than 0, the 'mark as read' did not have any
impact.

This commit fixes this issue by ensuring that the unread counter
of a document thread matches the number of needaction messages it
contains.

Task-ID 1875668
2018-09-20 17:19:02 +02:00
Alexandre Kühn e2b41f0dfe [FIX] mail: add missing abstract method in AbstractThread 2018-09-20 17:19:02 +02:00
XavierDo f7957fb6aa [FIX] mail: prevent redirect to app switcher
Before this commit, trying to send or preview a mail from a kanban view was
redirecting to the appswitcher.
2018-09-20 12:42:33 +02:00
Olivier Dony 84af9382e2 [IMP] mail: avoid costly queries on messages
The combined domain for moderated messages used to trigger a complex
database query with two OR conditions on the mail_message table.
Unfortunately PostgreSQL seems to be unable to optimize this with
indexes, or to detect that one of the conditions is void (included `AND
FALSE`). On large mail_message tables, this significantly slows down
calls to message_fetch, e.g. 6s instead of ~70ms, while returning the
same results.

As a workaround, move the logic for generating the moderation domain to
the server side, where it can be:
 - optimized out when the user is not a moderator
 - split into 2 distinct DB queries in order to avoid the pathological
   case

After this change, calls to message_fetch with and without messages
to moderate execute in respectively ~50ms and ~150ms, instead of 6s, in
a test database with 25 million messages.

The modified message_fetch signature is backwards-compatible.

+ modified mock server used for the tests, which unfortunately
duplicates most of the business logic.
2018-09-20 12:41:03 +02:00
XavierDo 97dbdc418d [FIX] mail: keep update of subtypes in dropdown
Since saas-11.4 the subtype dropdown don't keep changes of subtype.

Before saas-11.4 the update was relying on the fact that the follower id
changes on each subtype edition. This is no longer the case.
The test is addapted to remove the hack simulating this behaviour.

The read_followers route is not called if no there is no changes
in the follower ids
https://github.com/odoo/odoo/blob/905e01921f3c3ef43ace6fc537d1d8c0d280002c/addons/mail/static/src/js/followers.js#L195
Leading to the follower list not being update

Note that the subtype update in dropdown was working fine after adding a
new follower: the read_followers will return a None as suptype when called
for a list of partner not containing the current user. Since the subtypes
was falsy, the render was not rendering the dropdown again, keeping
the value of the checkboxes. We can still create some inconsistency by
editing the subtype from the follower list. To avoid that a check is made
when updating subtypes after calling read_followers.

The chosen solution here is to keep the update on subtypes in memory.
This will avoid a call on read_followers to fetch information that we
already know, using the assumption that the operation was successfull
whish should be the case when a user edit subtypes on a record
he has access to.

Others solutions:
-force the call to read_followers with the current user, maybe by removing
it from this.follower after editing subtypes.
-call read_subscription_data explicitely

Obviously follower.js should be refactored to fix this a better way.

Task: #1886982
PR: #27093
2018-09-19 14:10:19 +02:00
sri-odoo ed2773e381 [REF] mail: activities list, ‘mark as done’ sliding panel
Refactor ‘mark as done’ popup JS in order to use a sliding panel layout instead.
Sliding panels are currently needed in kanban views, where activities are listed in a dropdown that can't handle popups because of CSS overflow and lack of space.

Since this new system check for default bootstrap data-toggle attributes, it could be easily used elsewhere changing the buttons's data-toggle and providing the necessary container for the “mark as done” form.
2018-09-18 13:44:00 +02:00
XavierDo 47496b9fe5 [IMP] mail: add force_next on activity type
A new field on activity type allow to change the behaviour of mark done & schedule next:
-marking as done will automatically schedule the next activity, based on the default_next_activity.
-It should also be impossible to edit an activity when this flag is on.

task: #1884521
2018-09-18 13:44:00 +02:00
ThanhDodeurOdoo 389cb3e8dd [REF] mail: update related_attachment_count field name to match mixin namespace.
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-17 19:12:25 +02:00
Alexandre Kühn 7075142bd4 [FIX] mail: counter color green in community
It was blue over blue with the change of the navbar.
Before the navbar change, it was blue over black.

To avoid blue over blue, counter is now green, so that
it is green over blue.
2018-09-17 16:46:53 +02:00
Christophe Simonis 2426a8d669 [FIX] mail: adapt forward-ported code and test to BS4 2018-09-15 18:32:30 +02:00
Christophe Simonis 9c77066f34 [MERGE] forward port branch saas-11.4 up to 6c103589c1 2018-09-14 16:00:17 +02:00
Christophe Simonis f3fa5a5ef7 [MERGE] forward port branch saas-11.3 up to 1e0a92c996 2018-09-13 19:30:33 +02:00