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.
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
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
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.
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.
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
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
- '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
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.
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.
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.
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
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
The _mockMessageFetch method was changed in the mockserver in saas11.2.
The forward port then obviously broke this test, which depended on the
fact that it returns an empty list.
Transifex URLs have an original scheme using #lang, followed by the module or
'$' (for any module) and the searched text can be quoted
Before this commit the link was cut after
https://www.transifex.com/odoo/odoo-11/translate/#fr/, making the link not
clicable
Closes#24346
Before this commit, when we have a notification in the messaging menu (systray)
that comes from a message in inbox which isn't linked to a document
(e.g. a task), clicking on it result in a crash.
This issue comes from a typo of a recent js mail refactoring [1]
Although this is only a 1-line fix, there are no tests on the messaging menu
widget in the systray. Therefore, this commit also introduces some basic tests
of this widget, in addition to the test related to the fixed issue.
[1] https://github.com/odoo/odoo/commit/02ec09cb1c3e2d7bc7968f40c18f2208d7f3f498
The discuss application starting process is strongly asynchronous.
However, it relies implicitely on the fact that the widget is not
destroyed in its starting process. For example, if the widget is
detroyed before the updateChannel method is called, then any call to the
chat manager service will return undefined and the widget will crash.
When discuss is destroyed exactly between the start and the end of the
creation of its search view (which is asynchronous), then it is possible
to have a crash, because the search view will be destroyed when the
do_search method is called.
Note that we had to fix discuss mobile as well:
The _setChannel method is supposed to return a deferred, but the mobile
override did not return it. As a result, a test in the mobile suite
failed because this.alive takes a deferred in argument.
The discuss application starting process is strongly asynchronous.
However, it relies implicitely on the fact that the widget is not
destroyed in its starting process. For example, if the widget is
detroyed before the updateChannel method is called, then any call to the
chat manager service will return undefined and the widget will crash.
When discuss is destroyed exactly between the start and the end of the
creation of its search view (which is asynchronous), then it is possible
to have a crash, because the search view will be destroyed when the
do_search method is called.
Note that we had to fix discuss mobile as well:
The _setChannel method is supposed to return a deferred, but the mobile
override did not return it. As a result, a test in the mobile suite
failed because this.alive takes a deferred in argument.
User notifications are defined as
* notes;
* pushed to user Inbox or email through classic notification process;
* not linked to any document, meaning model and res_id are void;
When pushed in user's Inbox they are currently displayed with a gray
background like all notes. However UX experts think it should use a white
background to be easier to spot in chatter. This commit makes it work.
From now on discussion and user's notifications are displayed using a white
background. This commit is related to task ID 1829872.
This commit refactors f488dc58c3 that added reminder feature in activities.
After merging it was suggested specifications were not correct and it has
been decided to move the whole reminder feature in note.
Reminders are now notes instead of activities. Now when having note appµ
systray proposes to create a note / reminder. A note.note record is created
with info given by the user. If a date is given in the systray quick create
then an activity is scheduled on this note.
This means user can create records in activity systray that are not
activities but notes used as reminders. Those will use the first availableµ
note column for the user.
As reminders are now notes the support of activities not linked to any
document is removed, as well as archiving activities and tests linked to
that behavior.
This commit has been not carefully tested nor in-depth reviewied. It is
considered as too important for the upcoming freeze. This closes task ID
1833628. Closes#24129 . Many thanks to @dpr-odoo for its quick development
and good work on this task.
This commit fixes two issues with discuss tests (JS):
1. Improved mocked `message_fetch` rpc
Some tests were incorrectly mocking the `message_fetch` rpc.
With this commit, the mock server correctly mock this route,
so that tests should simply pass the records as data, and the
mock server correctly handles this rpc.
2. Patch `_.debounce` and `_.throttle`
The test "older messages are loaded on scroll" failed with
Google Chrome right after destroying the widget discuss.
This is due to a debounced function that called its inner
function at this moment.
With this commit, any discuss test patch `_.debounce` and
`_.throttle` so that the inner functions are executed
immediately and synchronously.
Before this commit:
Clicking on 'unstar all' button removes all messages from starred channel
but it only decreases the counter as many as there are displayed messages
on screen.
For example, if there are 40 messages starred, only 30 messages
are on screen (default limit) but unstar all will decrease counter
only for those messages instead of 40.
After this commit:
clicking on 'unstar all' button will correctly take in account all
fetched messages and not only displayed messages.
So now, after clicking on 'unstar all' button will update the starred
counter to 0.
task-ID: 33958
After this rev., in Discuss, messages are automatically loaded when
the user scrolls to the top of the channel.
Task 33958
Co-authored-by: Aaron Bohy <aab@odoo.com>
This commit allows to create personal reminders and to manage them using
activities. It is done using activities not necessarily linked to a record
but only to a user. Reminders can be used for example as a personal todo
list.
Technically we choose to model a reminder as an activity related to no
record. This means having a void res_id and model. An activity type is
added to classify reminders in it.
Settings reminder as done is not done like classic activities. Indeed classic
activities are unlinked and a message is logged on the related document.
As there is no document for reminders those are archived instead. It means
an active field is added as well as an override of toggle_archive to update
systray counter.
Activities systray widget is improved to display reminders in activities
list. This entry leads to a kanban view of activities allowing their
management. It is also possible to create them directly from the systray
allowing a quick creation of reminders.
This commit is related to task ID 41745. Closes#22143 .
Co-authored-by: Dharmang Soni <dpr@odoo.com>
Co-authored-by: Xavier Dollé <xdo@odoo.com>
Before this commit, many2many email tags showed the recipient's name
and email address. Most of the time, the text was cut off in order to
fit in the maximum length of a many2many tag, so the email address was
usually not visible.
With this commit, many2many email tags now show only the recipient's
name. The recipient's email address is displayed when hovering on the
tag.
Task-ID 36677
Purpose of this commit is to clean a bit various classes and conditions.
First clean is the removal of o_mail_note class in activities less. It comes
from first implementation of activity widget and is not used anymore in
activity widgets rendering.
Second clean is the removal of o_mail_note class when displaying messages.
Only o_mail_discussion is used currently in chatter to make a different
background depending on whether the message is a discussion or not. All
we have to know to differentiate message display is whether it is a
discussion done by an user or not.
Tests have been updated to use o_mail_discussion class triggered by
the message being a discussion, aka a comment posted by an user.
The ChatManager has been refactored in saas-11.2 to make it fully
(and more easily) testable. This means that tests involving
messaging stuff written in previous versions need to be slightly
adapted when being forwardported to saas-11.2. In particular, the
3 tests adapted in this commit broke because of an include done in
the voip addon. Those tests have been added in 3809fc891.
Before this rev., the field widget 'mail_activity' kept an internal
cache of fetched activities (like the 'mail_thread' and
'mail_followers'). However, for activities, this cache may cause
issues.
For instance, create a new lead in 'My pipeline', schedule a
'Meeting' activity on that lead (it opens the Calendar view so
that real meetings can be created), create a meeting 2 weeks from
now, go back to the lead form view: the activity still diplays that
the meeting is today (when the view is refreshed, the correct date
is displayed).
This rev. removes the internal cache for this field widget, as the
activities can easily be updated in business flows (unlike messages
or followers).
This rev. also fixes a bug in the BasicModel, where the res_ids of
a list datapoint was altered in place to return a list of x2many
commands instead of the list of ids when being stringified. This
caused a traceback when opening a lead with activities, as soon
as the internal cache had been removed.
Revision on https://github.com/odoo/odoo/commit/a87d761fdbf345ada5dc93e0a686b08a0f5a0417
From the UX/UI changes above, we also changed the style for empty
inbox and starred in Discuss.
There are two issues with the empty boxes message:
1. The text is not centered at all (one word per line,
and everything is stuck on the left-side of the screen)
2. The style is inconsistent with nocontent message on search
In this commit, inbox and starred use the same style as the no_content
message from a search. The style of the nocontent from a search has been
slightly changed to mimick the intended style for inbox and starred:
- centered text
- title is in bold 125% font size
- other text is not in bold, 115% font size.
Revision on https://github.com/odoo/odoo/commit/02ec09cb1c3e2d7bc7968f40c18f2208d7f3f498
From the refactoring above, some snake_case attributes have been
converted into camelCase. That was the case in discuss.js, but
we missed to propagate the changes in discuss_mobile.js.
This commit fixes the traceback that came from the mistake above.
Before this commit, when using createDiscuss and performing
discuss.destroy, the parent widget was not destroyed.
This is an issue, because the mocked environment is attached
to the parent widget of discuss. Any call to this.getSession()
is mocked by the addMockEnvironment, and this mocked behaviour
is removed only when the corresponding widget is destroyed.
This commit overrides discuss.destroy(), so that the parent
widget is also destroyed, so that it removes the side effect on
this.getSession() from the mocked environment.
Before this commit, on a clear session, there was a traceback
after focusing out the emoji button next to the composer.
This is due to a DOM element that exists only after clicking on
the emoji button, and it was wrongly assumed that focusout cannot
occur without a preceding click. Indeed, we can press TAB to move
between focusable elements, so that we can have the focus in/out
on the button without clicking on it.