diff options
| author | Aaron Bohy <aab@odoo.com> | 2015-11-24 15:30:25 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2015-11-27 11:47:34 +0100 |
| commit | db8203c27a21acdbcad2cf1c394b6fea3cf13688 (patch) | |
| tree | 32b886c20afe00b22c05192ae6387edc5c8a1a6b /addons/mail/static/src/xml | |
| parent | 9ef3a9296d02ca27e728de1bb2582821269f1b26 (diff) | |
[FIX] base,hr,mail: prefetch mention suggestions
The purpose of this commit is to improve the overall performance of the mention
mechanism of the client action and chatter composer, by pre-fetching some data.
First, the employees are fetched at chat initialization (basically, at web
client initialization), if hr is installed.
Second, when focusing on the composer of a channel, the members of this channel
are fetched. In the case of a chatter, the members are already known as they
are the followers of the document.
When the user types a mention, we first display suggestions from the pre-fetched
partners, and we only perform an RPC when there are no more result matching the
search string. This RPC searches among user, and then partners if there aren't
enough matches.
A few side changes occurred:
- auto_join set to True on user_ids field of res.partner to boost the query
that searches partners that are users
- the '/mail/read_followers' route now returns follower's email as well, as
we need it for the mention;
- a partner can now be mentionned several times in the same message;
- mentionned partner previsualization has been removed, mainly because of
the previous point, but also because it simplifies the code;
Diffstat (limited to 'addons/mail/static/src/xml')
| -rw-r--r-- | addons/mail/static/src/xml/chatter.xml | 2 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/composer.xml | 33 |
2 files changed, 6 insertions, 29 deletions
diff --git a/addons/mail/static/src/xml/chatter.xml b/addons/mail/static/src/xml/chatter.xml index 6cc8b86b19e..f8ce3057e14 100644 --- a/addons/mail/static/src/xml/chatter.xml +++ b/addons/mail/static/src/xml/chatter.xml @@ -6,7 +6,7 @@ --> <t t-name="mail.chatter.ChatComposer" t-extend="mail.ChatComposer"> <!-- Insert information before the composer --> - <t t-jquery=".o_composer_mentioned_partners" t-operation="before"> + <t t-jquery=".o_composer_attachments_list" t-operation="before"> <!-- Internal note composer --> <t t-if="widget.options.is_log"> <span class="o_chatter_composer_info"> diff --git a/addons/mail/static/src/xml/composer.xml b/addons/mail/static/src/xml/composer.xml index e47363c07bf..9a1e679c4ba 100644 --- a/addons/mail/static/src/xml/composer.xml +++ b/addons/mail/static/src/xml/composer.xml @@ -2,7 +2,6 @@ <templates xml:space="preserve"> <div t-name="mail.ChatComposer" class="o_chat_composer"> - <div class="o_composer_mentioned_partners"/> <div class="o_composer_attachments_list"/> <div class="o_composer"> <textarea class="o_composer_input" placeholder="Write something"/> @@ -33,16 +32,16 @@ </t> </t> - <t t-name="mail.ChatComposer.MentionPartnerSuggestions"> + <t t-name="mail.ChatComposer.MentionSuggestions"> <ul class="dropdown-menu" aria-labelledby="dropdownMailMentionMenu"> <t t-set="show_divider" t-value="false"/> <t t-foreach="suggestions" t-as="group"> - <t t-foreach="group" t-as="partner"> - <li t-if="show_divider && (partner_index === 0)" class="divider"/> + <t t-foreach="group" t-as="suggestion"> + <li t-if="show_divider && (suggestion_index === 0)" class="divider"/> <t t-set="show_divider" t-value="true"/> - <li class="o_mention_proposition" t-att-data-id="partner.id"> + <li class="o_mention_proposition" t-att-data-id="suggestion.id"> <a href="#"> - <t t-esc="partner.name"/> <t t-if="partner.email">(<t t-esc="partner.email"/>)</t> + <t t-esc="suggestion.name"/> <t t-if="suggestion.email">(<t t-esc="suggestion.email"/>)</t> </a> </li> </t> @@ -50,26 +49,4 @@ </ul> </t> - <t t-name="mail.ChatComposer.MentionChannelSuggestions"> - <ul class="dropdown-menu" aria-labelledby="dropdownMailMentionMenu"> - <t t-set="show_divider" t-value="false"/> - <t t-foreach="suggestions" t-as="group"> - <t t-foreach="group" t-as="channel"> - <li t-if="show_divider && (channel_index === 0)" class="divider"/> - <t t-set="show_divider" t-value="true"/> - <li class="o_mention_proposition" t-att-data-id="channel.id"> - <a href="#"><t t-esc="channel.name"/></a> - </li> - </t> - </t> - </ul> - </t> - - <t t-name="mail.ChatComposer.MentionTags"> - <t t-if="partners.length">Mention(s): </t> - <t t-foreach="partners" t-as="partner"> - <span class="badge"><t t-esc="partner.name"/></span> - </t> - </t> - </templates> |
