summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/xml
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2015-11-26 10:48:29 +0100
committerGéry Debongnie <ged@odoo.com>2015-11-26 14:27:11 +0100
commit7137891a8a5d024a7f36a5af1d3a3c2686a9a96a (patch)
tree4ac17ad2c8cdaee63a92ba3dc73b44cc422ab483 /addons/mail/static/src/xml
parentbef0da3a7aff74fecce7b418164257ad0cd37c4d (diff)
[FIX] mail, im_livechat: correctly displayed message date
Messages are required to be displayed in a smarter way: relative to the current date, if it's a recent message, or absolute if not. This commits rework most of the date processing code to comply with these requirements. Messages were preprocessed each time a thread is rendered, which is stupid. It should be preprocessed only when the message is created. This was a small problem because livechat does not use the chat manager, so a simplified version of the preprocessing had to be done.
Diffstat (limited to 'addons/mail/static/src/xml')
-rw-r--r--addons/mail/static/src/xml/thread.xml14
1 files changed, 7 insertions, 7 deletions
diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml
index 394627940cb..70996dd7d47 100644
--- a/addons/mail/static/src/xml/thread.xml
+++ b/addons/mail/static/src/xml/thread.xml
@@ -30,11 +30,11 @@
<t t-if="options.messages_separator_position == 'top'" t-call="mail.MessagesSeparator"/>
<t t-set="current_day" t-value="0"/>
<t t-foreach="messages" t-as="message">
- <div t-if="current_day != message.date.split(' ')[0]" class="o_thread_date_separator">
+ <div t-if="current_day != message.day" class="o_thread_date_separator">
<span class="o_thread_date">
- <t t-esc="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('LL')"/>
+ <t t-esc="message.day"/>
</span>
- <t t-set="current_day" t-value="message.date.split(' ')[0]"/>
+ <t t-set="current_day" t-value="message.day"/>
</div>
<t t-call="mail.ChatThread.Message"/>
@@ -56,8 +56,8 @@
t-att-src="message.avatar_src"
class="o_thread_message_avatar"/>
</t>
- <span t-if="!message.display_author" t-att-title="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('LLL')" class="o_thread_message_side_date">
- <t t-esc="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('hh:mm')"/>
+ <span t-if="!message.display_author" t-att-title="message.date" class="o_thread_message_side_date">
+ <t t-esc="message.date.format('hh:mm')"/>
</span>
<i t-if="!message.display_author &amp;&amp; options.display_stars &amp;&amp; message.message_type != 'notification'"
t-att-class="'fa o_thread_message_star ' + (message.is_starred ? 'fa-star' : 'fa-star-o')"
@@ -83,8 +83,8 @@
<t t-esc="message.displayed_author"/>
</strong>
- <small t-att-title="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('LLL')">
- - <t t-esc="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('hh:mm A')"/>
+ <small t-att-title="message.date">
+ - <t t-esc="message.hour"/>
</small>
<t t-if="message.model &amp;&amp; (message.model != 'mail.channel') &amp;&amp; options.display_document_link">
on <a class="o_mail_redirect" href="#" t-att-data-oe-model="message.model" t-att-data-oe-id="message.res_id"><t t-esc="message.record_name"/></a>