Commit Graph
2209 Commits
Author SHA1 Message Date
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
Christophe Simonis 6c103589c1 [MERGE] forward port branch saas-11.3 up to ea0b3d600d 2018-09-14 14:56:51 +02:00
Christophe Simonis ea0b3d600d [FIX] mail: declare services used in forward-ported test
Only broke test with enterprise overwrite.
2018-09-14 14:05:24 +02:00
Christophe Simonis f3fa5a5ef7 [MERGE] forward port branch saas-11.3 up to 1e0a92c996 2018-09-13 19:30:33 +02:00
Christophe Simonis 826cd9b3d3 [MERGE] forward port branch 11.0 up to c3ea0a7811 2018-09-10 19:21:57 +02:00
Lucas Perais (lpe) bb12890977 [FIX] mail: activity don't loose text of feedback popover
On an activity, click Mark as done, the popover pops over
Now write some text in it, but click somewhere else, like to copy/paste something
The popover looses focus, and your text disappears

After this commit, we store the value of the popover when hiding it,
then, when when showing back the popover, the value is reinjected

OPW 1873999
closes #26315
2018-09-10 11:24:42 +02:00
XavierDo 62928bb81a [FIX] mail: make red envelope visible when necessary
We need to know if a notification is in failure by
displaying the red envelope in even if all partner are inactive.

This commit also fix the filter in order to display notification
of all active partners if there is an exception.
2018-09-06 10:34:14 +02:00
XavierDo d0e957109f [FIX] mail: allow resend on bounce
Only o_thread_message_email_exception red envelope was clickable.
We should be able to resend bounce too.
2018-09-06 10:33:52 +02:00
Martin Trigaux 9aa750bffc [FIX] mail: add missing emoji 2018-09-05 11:57:06 +02:00
Christophe Simonis 8285630ad2 [MERGE] forward port branch saas-11.3 up to 609491ad0e 2018-07-13 17:12:07 +02:00
Christophe Simonis f3929aa0f7 [MERGE] forward port branch saas-11.2 up to 87dadc5bc8 2018-07-13 14:32:05 +02:00
Christophe Simonis c952a11770 [MERGE] forward port branch 11.0 up to 6e6e3d4c96 2018-07-13 10:47:18 +02:00
XavierDo 62591c58f8 [FIX] mail: add ability to mark failure notification as read
The mark as read button was not working for mail failure. More than that,
we wanted a functionnality to be able to massively mark mail failure as canceled,
especially to be able to clean databases from failure after migration.

Task: #1860054
PR: #25622
2018-07-11 12:25:33 +02:00
Alexandre Kühn 212ed85ac4 [FIX] mail: upload again a same file on the composer
Before this commit, it was not possible to upload again a file on the
browser from the composer, when it was added then removed from the attachments.

When a file is uploaded on the browser, it writes on a special input
some data to identify this file. In order to detect a new upload,
the code listens on the JQuery event `change` on this input. Since the
value of this input was not cleared after an attachment removal, the
user couldn't reupload the same file, because the value of the input
will be unchanged.

This commit solves this issue by clearing the special input when removing
an attachment, so that adding the same file again will trigger a `change`
on this input.
2018-07-10 15:30:30 +02:00
Alexandre Kühn fb98bb009a [FIX] mail: remove attachment when clicking on white cross icon
Before this commit, we could not remove an attachment in the composer
by clicking on the white-cross icon that is shown on mouse hover.

This was due to the handler function picking the wrong DOM element
as target for reading on the attachment ID: it should pick the target
of this handler function, and not the specific target below the mouse
on click. For instance, let's consider this HTML snippet for the button:

    ```
    <div class='delete' data-attachment-id=100>
        <span class='cross-icon'>X</span>
    </div>
    ```

where the handler function is called when clicking on `div.delete`.

When we click on `span.cross-icon`, it triggers the handler function
of `div.delete`. The MouseEvent object contains the following property
values:

    - `target`: the `<span>` element
    - `currentTarget`: the `<div>` element

The handler function of `div.delete` deletes an attachment by looking
into the `data-attachment-id` attribute of `div.delete`. It should
always pick `div.delete`, even when the user clicks on `span.cross-icon`.
2018-07-10 15:25:02 +02:00
Alexandre Kühn 5dcfb30fb3 [FIX] mail: no crash on opening messaging menu after receiving a needaction message
Revision on https://github.com/odoo/odoo/commit/299ebb2cdf63de2e3967da0d2f3e7effd239812b
    [IMP] mail: add moderation on channels

The commit above adds moderated channel. When a message is pending moderation,
it is not yet linked to the channel server-side, which is why there is a hack
to set `channel_ids` on the client side so that the message is visible on the
corresponding channel (only for author of message and moderator of channel).

It is only when the message is accepted that this message is linked to the
correct `channel_ids`. The server provides the updated list of channels that
this message is linked to, but it misses static channels that only make sense
on the client-side, such as "Inbox" or "Starred".

This commit solves the issue by only extending the list of channel registered
on the message when it is accepted, so that static channels are not unlinked
from the message.

Note that it is necessary to update `channel_ids` of the message,
because there could be "relay" channels. In other words, when the moderated
message is accepted, there could be more channels that contain this message.
2018-06-29 12:57:05 +02:00
Christophe Simonis c8bb02141d [MERGE] forward port branch saas-11.3 up to 3cdcbce93c 2018-06-28 19:01:52 +02:00
Christophe Simonis b06af028e6 [MERGE] forward port branch saas-11.2 up to d112a163cd 2018-06-28 10:55:12 +02:00
Christophe Simonis d112a163cd [MERGE] forward port branch 11.0 up to f6d36d81f7 2018-06-28 10:32:03 +02:00
Nicolas Lempereurandqsm-odoo f6d36d81f7 [FIX] mail: discuss smileys on several lines
In the discuss composer on google chrome, when when the smileys have
more width than available, they stayed on one line and would increase
page size (adding an horizontal scrollbar).

This happened really easily in saas-11.3 because we have more smileys,
but still happened in 11.0 depending on the screen size.

opw-1861191
closes #25507

Co-authored-by: qsm-odoo <qsm@odoo.com>
2018-06-28 09:05:36 +02:00
Christophe Simonis 40836194c2 [MERGE] forward port branch saas-11.2 up to 12ddec3a76 2018-06-27 13:41:00 +02:00
XavierDo 3ea85a603e [FIX] mail: fix forwardport mistake
A part of the code was unreachable after merging forwardport.

Closes #25477
2018-06-26 11:58:59 +02:00
Aaron Bohy ffe9bb501b [FIX] mail: test utils: mock is_odoo_focused
In the mocked version of the longpolling bus used in tests, the
is_odoo_focused function should be defined to prevent crashes when
we simulate incoming messages.
2018-06-21 13:55:10 +02:00
Aaron Bohy cf3cc98f1c [FIX] mail: set correct parent to ChatWindows
Since the ChatWindowManager is a service, this is no longer
necessary to set the webclient as parent of ChatWindow's instances.

This rev. sets the ChatWindowManager itself as parent, which makes
much more sense, and which allows to properly mock the whole
ChatManager-ChatWindowManager environment in tests.
2018-06-21 13:55:10 +02:00
Alexandre Kühn b74d1e90ef [FIX] mail: warn user on record reload before post message
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-06-15 17:46:32 +02:00
Christophe Simonis 73652a0b19 [MERGE] forward port branch saas-11.3 up to 50860317cc
Note: 1aacc96262 has been ignored and will
be forward-ported later
2018-06-15 13:27:27 +02:00
Christophe Simonis 50860317cc [MERGE] forward port branch saas-11.2 up to b170a753e1 2018-06-15 11:30:27 +02:00
Christophe Simonis b170a753e1 [MERGE] forward port branch 11.0 up to b05e4d5f95 2018-06-15 10:15:27 +02:00
Christophe Simonis b05e4d5f95 [MERGE] forward port branch saas-15 up to a53bea49fe 2018-06-14 21:28:39 +02:00
Christophe Simonis 803df909b1 [MERGE] forward port branch saas-14 up to 804d68efe5 2018-06-14 18:05:38 +02:00
Christophe Simonis 804d68efe5 [MERGE] forward port branch 10.0 up to 23a1bce2a9 2018-06-14 18:03:26 +02:00
jlzhou 68cde40515 [FIX] mail: fix translation issue in client notification
Closes #19095.
2018-06-13 11:03:46 +02:00
Christophe Simonis af1853775f [MERGE] forward port branch 11.0 up to e3658d6f56 2018-06-12 16:49:11 +02:00
Lucas Perais (lpe) dded98a04c [FIX] mail: open a channel in discuss on systray click
User B mentions @UserA in a channel on discuss
User A gets two notifications: one for direct chat,the other for the channel
User A clicks on the notification for the channel

Before this commit the form view of the channel was opened

After this commit, the channel is opened in discuss

OPW 1849577
closes #25074
2018-06-08 10:06:11 +02:00
XavierDo 133eeb1bbf [ADD] mail, mass_mailing: allow a user to resend a mail with failures
When a mail is in failure state, a red envelope appears next to the message
in a thread but it was difficult to send the mail again.
This tasks will allow users to send mail again easily, or mark notification
as cancelled if the user want to ignore this failure.
A notification will appear in sender systray while mail are in failure.

Task: #46158
PR: #24628
2018-06-07 11:46:28 +02:00
XavierDo aa7fb8c723 [IMP] mail: add warning when partner email is invalid
Change the border and cross color of a recipient in mail
composer when the email is invalid (doesn't contains "@").

When sending an mail from composer the user will see easily
if an email adress is invalid and will cause a NO_VALID_RECIPIENT
error.

Task: #46158
PR: #24628
2018-06-07 11:46:28 +02:00
Prakash Prajapati d8a5141c17 [FIX] mail: Add a mark as read option on systray message dropdown
- 'Mark as Read' icon will be shown by moving the mouse over the message
- if it's channel then make it Mark as Seen
- if it's inbox notification then mark all message as read
- The inbox notification icon has been changed

This commit is related to task ID 1817646
2018-06-06 17:01:26 +02:00
Mathieu Duckaerts-Antoine 299ebb2cdf [IMP] mail: add moderation on channels
Purpose of this commit is to allow moderation on incoming messages in
discussion channels. On some channels on which moderation is required
messages should be in a pending moderation stage. Moderators can accept
or refuse messages as well as always allow or ban messages coming from
a given set of emails.

Channels now have an option to be moderated. Moderators can be added on
channels. They have access to a specific UI in Discuss to see and take
action on messages waiting for moderation.

Concerning mail.thread message that are pending moderation are not notified.
It means nobody receives a notification about them. Moderation process calls
the notification once the message is validated.

Various features included in this commit :

 * a model is added to store the decision about emails, allow or ban;
 * access rights are updated so that only moderators can modify moderation
   fields on message;
 * specific bus notifications are send to moderated people as well as to
   moderators on incoming emails as well as when a decision is taken;
 * options are added on channels to send explanations to moderated emails;
 * options are added on channels to write and send guidelines explaining
   why and how moderation is performed;
 * a reminder is send daily to moderators with remaining messages to moderate;
 * discuss UI is adapted and a new channel is added below Inbox and Starred
   giving access to moderation tools;
 * chanenl UI is adapted allowing to moderate directly inside channels;

This commit is linked to task ID 29521. Closes #21921.
2018-06-06 16:01:33 +02:00
Barad Mahendra 4a59f93d15 [IMP] mail, calendar: add today meetings in systray
Purpose of this commit is to display today meetings in the systray. This will
help people in their daily job to have quickly access to their meetings.
It is displayed along with activities and reminders to have all current work
to do in the same place.

Displayed meetings are ongoing or not yet started ones of the current day.
All-day meetings of the current day are also shown. Done meetings are not
displayed to lessen noise.

Clicking on the systray will open the calendar view of meetings in a day
mode. This is done by a small modification in the calendar view allowing
to choose the display mode from context in addition to the mode attribute
of the action definition.

This commit is linked to task ID 60593. Closes #24438. Thanks to @ged-odoo
for quick reviewing.
2018-05-31 16:49:56 +02:00
Mahendra Barad 642970494e [REF] mail, note: rename systray method giving data for web client
As it becomes used to display more things than just counting activities let
us rename the method. Future commits will add new features in the systray
like meetings.

This commit is linked to task ID 60593.
2018-05-31 16:45:51 +02:00
Thibault Delavallée fbec51f476 [IMP] mail: improve default channel picture
Purpose is to avoid having void image in systray when there are notifications
linked to channels that have no picture. Two small improvements are done on
channel model
 * change default picture for channel to be more inline with Odoo design
   guidelines;
 * override create to ensure there is a default image when creating the
   channel through the discuss interface;

This commit is linked to task ID 48228.
2018-05-30 15:00:01 +02:00
Christophe Simonis f36e6917bd [MERGE] forward port branch saas-11.3 up to 37eed7c509 2018-05-29 17:34:43 +02:00
Christophe Simonis 37eed7c509 [MERGE] forward port branch saas-11.2 up to 58e3552246 2018-05-25 14:34:18 +02:00
Darshil Trivedi 03fe5a8a70 [IMP] mail: improve usability of activities
This commit improves the daily use of activities through some small updates

 * on hover of clock icon in kanban card display tooltip. Purpose of this
   change is to clarify meaning of colors displayed in kanban view. Otherwise
   just havign a color is not very meaningful;
 * add days string in planned in column;
 * add space between number and days in planned in field;

This commit is related to task ID 1838315.
2018-05-25 10:58:24 +02:00
Christophe Simonis 2bc6ea1b37 [MERGE] forward port branch 11.0 up to 02ee3fd88e 2018-05-23 19:33:40 +02:00
Géry Debongnie d01787c19d [IMP] web,mail: improve search view for mobile devices
With this commit, we introduce a better screen to manipulate the search
view in a mobile device.

Note: most of this work was initially done by suh-odoo, then was adapted
and moved to community by myself.

task 31464
2018-05-23 10:48:36 +02:00
Denis Ledoux 36d45175b0 [FIX] mail: translate activity type in kanban
When opening the activity dropdown in the kanban view
of the opportunities,
the activity type names were not translated in the user language.

In addition, when marking it as done, the message
posted in the discussion thread of the opportunity
was not translated either.

opw-1847908
2018-05-18 12:31:07 +02:00
Christophe Simonis 644f0959d0 [MERGE] forward port branch saas-11.2 up to 1655202924 2018-05-17 14:23:37 +02:00
Alexandre Kühn 93f9131450 [REVERT] "[IMP] mail : display mentions in green color in edit mode"
This reverts commit c778de44c7.
2018-05-16 15:06:39 +02:00