summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/xml/thread.xml
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-12-05 14:35:29 +0000
committerAlexandre Kühn <aku@odoo.com>2018-12-06 16:18:10 +0000
commit844fb2b51ea7cfa557b19466c0a53dde19433e7a (patch)
tree8b092fb030790b77ebc1c4061bac08c8edc3befa /addons/mail/static/src/xml/thread.xml
parent15bbadb69b1b26404a614736c3cde7980d3c1dfd (diff)
[IMP] mail: channel seen icon indication ('v' and 'vv')
This commit adds the seen icon next to a message for all channels except livechat. It tracks received and seen messages for all members of the channel. Icon is either 1 or 2 check(s) ('v' or 'vv'). Those are the different states of this 'seen' icon: ICON: DESCRIPTION: no check .................. no one has received the message. 1 check ................... some members have received the message, no one has seen it. 2 checks (greyed-out) ..... some members have seen the message, some or everyone has received it 2 checks (green) .......... all members have seen the message This icon is not shown for messages preceding the last message seen by everyone, in order to reduce visual noise. Task-ID 1881001
Diffstat (limited to 'addons/mail/static/src/xml/thread.xml')
-rw-r--r--addons/mail/static/src/xml/thread.xml66
1 files changed, 66 insertions, 0 deletions
diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml
index 748b9d4edc6..fcfe8ba7de2 100644
--- a/addons/mail/static/src/xml/thread.xml
+++ b/addons/mail/static/src/xml/thread.xml
@@ -281,6 +281,7 @@
<i t-if="!displayAuthorMessages[message.getID()] and options.displayStars and message.getType() !== 'notification'"
t-att-class="'fa o_thread_message_star o_thread_icon ' + (message.isStarred() ? 'fa-star' : 'fa-star-o')"
t-att-data-message-id="message.getID()" title="Mark as Todo" role="img" aria-label="Mark as todo"/>
+ <t t-if="!displayAuthorMessages[message.getID()] and thread.hasSeenFeature()" t-call="mail.widget.Thread.Message.SeenIcon"/>
</div>
<div class="o_thread_message_core">
<p t-if="displayAuthorMessages[message.getID()]" class="o_mail_info text-muted">
@@ -319,6 +320,7 @@
<i t-att-class="'o_thread_tooltip o_thread_message_email o_thread_message_email_' + message.getCustomerEmailStatus() + ' fa fa-envelope-o'" t-att-data-message-id="message.getID()"/>
</span>
<span t-attf-class="o_thread_icons">
+ <t t-if="thread.hasSeenFeature()" t-call="mail.widget.Thread.Message.SeenIcon"/>
<i t-if="options.displayStars and !message.isSystemNotification() and !message.needsModeration()"
t-att-class="'fa fa-lg o_thread_icon o_thread_message_star ' + (message.isStarred() ? 'fa-star' : 'fa-star-o')"
t-att-data-message-id="message.getID()" title="Mark as Todo" role="img" aria-label="Mark as Todo"/>
@@ -364,6 +366,70 @@
</t>
<!--
+ Display the seen icon of a message in the thread.
+ It shows the fetch 'check' before the seen 'check'. We change the order in the template
+ so that fetch 'check' is on top of 'seen' check (z-index does not work with absolute positioning)
+
+ @param {mail.model.Thread} thread
+ @param {mail.model.Message} message
+ -->
+ <t t-name="mail.widget.Thread.Message.SeenIcon">
+ <t t-if="message.isMyselfAuthor() and message.getID() >= thread.getLastMessageIDSeenByEveryone()">
+ <span t-attf-class="o_mail_thread_message_seen_icon #{thread.hasEveryoneSeen(message) ? 'o_all_seen' : ''}" t-att-data-message-id="message.getID()">
+ <t t-if="thread.hasSomeoneFetched(message)">
+ <i class="fa fa-check"/>
+ </t>
+ <t t-if="thread.hasSomeoneSeen(message)">
+ <i class="fa fa-check"/>
+ </t>
+ </span>
+ </t>
+ </t>
+
+ <!--
+ Display the popover content when clicking the seen icion of a message in the thread.
+
+ List the members that have received the messages, and the members that have seen it.
+
+ @param {mail.model.Thread} thread
+ @param {mail.model.Message} message
+ -->
+ <t t-name="mail.widget.Thread.Message.SeenIconPopoverContent">
+ <div class="o_mail_thread_message_seen_icon_content">
+ <t t-if="thread.hasEveryoneSeen(message)">
+ <p>Seen by Everyone</p>
+ </t>
+ <t t-else="">
+ <t t-if="thread.hasSomeoneSeen(message)">
+ <t t-set="seen_members" t-value="thread.getSeenMembers(message)"/>
+ Seen by:
+ <ul>
+ <li t-foreach="seen_members" t-as="member">
+ <t t-esc="member.name"/> (<t t-esc="member.email"/>)
+ </li>
+ </ul>
+ </t>
+ <t t-if="thread.hasSomeoneFetched(message)">
+ <t t-if="thread.hasEveryoneFetched(message)">
+ <p>Received by Everyone</p>
+ </t>
+ <t t-else="">
+ <t t-set="fetched_members" t-value="thread.getFetchedNotSeenMembers(message)"/>
+ <t t-if="!_.isEmpty(fetched_members)">
+ Received by:
+ <ul>
+ <li t-foreach="fetched_members" t-as="member">
+ <t t-esc="member.name"/> (<t t-esc="member.email"/>)
+ </li>
+ </ul>
+ </t>
+ </t>
+ </t>
+ </t>
+ </div>
+ </t>
+
+ <!--
@param {Object[]|undefined} list of customer email data of a given message.
A customer email data is a list with the following format:
[partnerID, partnerName, emailStatus]