[FIX] mail: various UI improvements

- vertically center date and messages separators in threads
- remove notifications in DM and livechat
- order mail demo data so that messages appear ordered (they are ordered by id)
- make sure that DM are pinned (they weren't on the receiver side)
- don't display DM until a message has been sent
- validate message body
- undo snackbar fine tuning
- fix Firefox scroll bug on sidebar rendering (the scroll position was often
  lost when the sidebar was re-rendered, seemingly because the width of the
  thread changed for a brief moment)
This commit is contained in:
Aaron Bohy
2015-11-17 10:06:18 +01:00
parent 0f5a146182
commit c51af45384
7 changed files with 116 additions and 100 deletions
+82 -80
View File
@@ -73,6 +73,81 @@
<field name="notify_email">none</field>
</record>
<!-- Thread: 1 incoming email -->
<record id="msg_discus5" model="mail.message">
<field name="subject">Plan to install backup servers</field>
<field name="body"><![CDATA[<p>Hello,</p>
<p>We need to deploy new backup servers, with the following requirements:</p>
<ul>
<li>daily incremental backups, with an history of 15 days,</li>
<li>45 servers should be backuped between 1am and 3am when our offices are closed,</li>
<li>two redundant servers,</li>
<li>total capacity of 200Gb.</li>
</ul>
<p>
Do you have a simple solution with servers running on Redhat Linux?
</p>
<p>Best regards,</p>
]]></field>
<field name="message_type">email</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="email_from">virginie@agrolait.fr</field>
<field name="author_id" eval="False"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.partner_demo'), ref('base.partner_root')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(days=2)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Short thread: Admin ask, Agrolait answer [DEMO: mark thread as done] -->
<record id="msg_discus1" model="mail.message">
<field name="subject">Feedback about our On Site Assistance</field>
<field name="body"><![CDATA[<p>Hi Virginie,</p><p>I wrote to you about our <i>On Site Assistance Service</i> that we delivered to Agrolait last week. Do you have any feedback or remark about our service? I noticed you requested new IP phones. Will it be used for new employees, or did you have any issue with the ones we provided?<br />Best regards,</p>]]></field>
<field name="message_type">comment</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="author_id" ref="base.partner_root"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.res_partner_2')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(days=2)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Admin and Demo with attachments -->
<record id="msg_discus4_attach1" model="ir.attachment">
<field name="datas">bWlncmF0aW9uIHRlc3Q=</field>
<field name="datas_fname">catalog.doc</field>
<field name="name">catalog.doc</field>
</record>
<record id="msg_discus4_attach2" model="ir.attachment">
<field name="datas_fname">activity_graph_2012.jpg</field>
<field name="name">activity_graph_2012</field>
<field name="datas" type="base64" file="mail/static/img/msg_discus4_attach2-datas.jpg"/>
</record>
<record id="msg_discus4" model="mail.message">
<field name="body"><![CDATA[<p>Hi Demo,</p>
<p>The next version of our products catalog is scheduled for next month. Our product team send me their updated document holding the prices and costs, and I updated our catalog.</p>
<p>You will find it in attachment, as well as a comparative benchmark of the different solutions currently existing on the market.<br />Have a nice reading!<br />
Sincerely,</p>]]></field>
<field name="message_type">comment</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="author_id" ref="base.partner_root"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.partner_demo')])]"/>
<field name="attachment_ids" eval="[(6, 0, [ref('msg_discus4_attach1'), ref('msg_discus4_attach2')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(days=1)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Thread: Epic Technologies and Admin as salesman discuss about a meeting [DEMO: see context, mark thread as done] -->
<record id="msg_discus2" model="mail.message">
<field name="subject">Information meeting</field>
<field name="body"><![CDATA[<p>Hello,</p><p>Epic Technologies is a small company specialized in software managing huge volume of data. Having an efficient and reliable backup system is very important for us, and critical for our customers. I eared you have some interesting solutions to manage our backups. Could we meet each other as soon as possible to discuss our need? Here is a first list of requirements:</p>
<ul>
<li>about 25 backup servers, running on Redhat Linux</li>
<li>minimum 200Gb of storage per server</li>
<li>setup a VPN between all our servers in New York and Chicago</li>
</ul>
<p>Thanks,</p>
]]></field>
<field name="message_type">comment</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="author_id" ref="base.res_partner_3"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.partner_root')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(days=1)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Discussion: attachments and spec [DEMO: search on has_attachments -->
<record id="msg_discus6_attach1" model="ir.attachment">
<field name="datas">bWlncmF0aW9uIHRlc3Q=</field>
@@ -117,53 +192,16 @@
<field name="date" eval="(DateTime.today() - timedelta(hours=3)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Thread: 1 incoming email -->
<record id="msg_discus5" model="mail.message">
<field name="subject">Plan to install backup servers</field>
<field name="body"><![CDATA[<p>Hello,</p>
<p>We need to deploy new backup servers, with the following requirements:</p>
<ul>
<li>daily incremental backups, with an history of 15 days,</li>
<li>45 servers should be backuped between 1am and 3am when our offices are closed,</li>
<li>two redundant servers,</li>
<li>total capacity of 200Gb.</li>
</ul>
<p>
Do you have a simple solution with servers running on Redhat Linux?
</p>
<p>Best regards,</p>
]]></field>
<field name="message_type">email</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="email_from">virginie@agrolait.fr</field>
<field name="author_id" eval="False"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.partner_demo'), ref('base.partner_root')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(days=2)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Admin and Demo with attachments -->
<record id="msg_discus4_attach1" model="ir.attachment">
<field name="datas">bWlncmF0aW9uIHRlc3Q=</field>
<field name="datas_fname">catalog.doc</field>
<field name="name">catalog.doc</field>
</record>
<record id="msg_discus4_attach2" model="ir.attachment">
<field name="datas_fname">activity_graph_2012.jpg</field>
<field name="name">activity_graph_2012</field>
<field name="datas" type="base64" file="mail/static/img/msg_discus4_attach2-datas.jpg"/>
</record>
<record id="msg_discus4" model="mail.message">
<field name="body"><![CDATA[<p>Hi Demo,</p>
<p>The next version of our products catalog is scheduled for next month. Our product team send me their updated document holding the prices and costs, and I updated our catalog.</p>
<p>You will find it in attachment, as well as a comparative benchmark of the different solutions currently existing on the market.<br />Have a nice reading!<br />
Sincerely,</p>]]></field>
<!-- Thread: Demo (network admin) and Admin -->
<record id="msg_discus3" model="mail.message">
<field name="body"><![CDATA[<p>Hello,</p><p>I have a friend working at Epic Technologies. He told me they plan to upgrade their backup servers within the next 3 months.</p><p>I think that someone should contact them and check if there is an opportunity.</p>]]></field>
<field name="message_type">comment</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="author_id" ref="base.partner_root"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.partner_demo')])]"/>
<field name="attachment_ids" eval="[(6, 0, [ref('msg_discus4_attach1'), ref('msg_discus4_attach2')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(days=1)).strftime('%Y-%m-%d %H:%M')"/>
<field name="author_id" ref="base.partner_demo"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.partner_root')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(hours=3)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<record id="msg_discuss4_1" model="mail.message">
<field name="body"><![CDATA[<p>Thank you!<br/>Could you send me the updated pricelists as negotiated at the beginning of this year?</p>
<p>Sincerely,</p>]]></field>
@@ -175,15 +213,6 @@
<field name="date" eval="(DateTime.today() - timedelta(hours=1, minutes=30)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Thread: Demo (network admin) and Admin -->
<record id="msg_discus3" model="mail.message">
<field name="body"><![CDATA[<p>Hello,</p><p>I have a friend working at Epic Technologies. He told me they plan to upgrade their backup servers within the next 3 months.</p><p>I think that someone should contact them and check if there is an opportunity.</p>]]></field>
<field name="message_type">comment</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="author_id" ref="base.partner_demo"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.partner_root')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(hours=3)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<record id="msg_discus3_1" model="mail.message">
<field name="body"><![CDATA[Contact Chris: +1 (650) 307-6736.]]></field>
<field name="parent_id" ref="msg_discus3"/>
@@ -194,23 +223,6 @@
<field name="date" eval="(DateTime.today() - timedelta(hours=1)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Thread: Epic Technologies and Admin as salesman discuss about a meeting [DEMO: see context, mark thread as done] -->
<record id="msg_discus2" model="mail.message">
<field name="subject">Information meeting</field>
<field name="body"><![CDATA[<p>Hello,</p><p>Epic Technologies is a small company specialized in software managing huge volume of data. Having an efficient and reliable backup system is very important for us, and critical for our customers. I eared you have some interesting solutions to manage our backups. Could we meet each other as soon as possible to discuss our need? Here is a first list of requirements:</p>
<ul>
<li>about 25 backup servers, running on Redhat Linux</li>
<li>minimum 200Gb of storage per server</li>
<li>setup a VPN between all our servers in New York and Chicago</li>
</ul>
<p>Thanks,</p>
]]></field>
<field name="message_type">comment</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="author_id" ref="base.res_partner_3"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.partner_root')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(days=1)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<record id="msg_discus2_1" model="mail.message">
<field name="subject">RE: Information meeting</field>
<field name="body"><![CDATA[<p>Hello Epic!</p>
@@ -253,16 +265,6 @@
<field name="date" eval="(DateTime.today() - timedelta(minutes=10)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<!-- Short thread: Admin ask, Agrolait answer [DEMO: mark thread as done] -->
<record id="msg_discus1" model="mail.message">
<field name="subject">Feedback about our On Site Assistance</field>
<field name="body"><![CDATA[<p>Hi Virginie,</p><p>I wrote to you about our <i>On Site Assistance Service</i> that we delivered to Agrolait last week. Do you have any feedback or remark about our service? I noticed you requested new IP phones. Will it be used for new employees, or did you have any issue with the ones we provided?<br />Best regards,</p>]]></field>
<field name="message_type">comment</field>
<field name="subtype_id" ref="mt_comment"/>
<field name="author_id" ref="base.partner_root"/>
<field name="partner_ids" eval="[(6, 0, [ref('base.res_partner_2')])]"/>
<field name="date" eval="(DateTime.today() - timedelta(days=2)).strftime('%Y-%m-%d %H:%M')"/>
</record>
<record id="msg_discus1_1" model="mail.message">
<field name="subject">RE: Feedback about our On Site Assistance</field>
<field name="body"><![CDATA[<p>Hello Administrator,</p><p>Glad to hear from you! Everything is perfect, thanks for asking. Concerning the order of 2 IP phones, I ordered them for new employees. We are satisfied with the products of <i>YourCompany</i>, and we plan to fit out each new employee with one of your phone this year.<br />Regards,</p>]]></field>
+5 -2
View File
@@ -494,8 +494,11 @@ class Channel(models.Model):
@api.multi
def channel_join_and_get_info(self):
self.ensure_one()
notification = _('<div class="o_mail_notification">joined <a href="#" class="o_channel_redirect" data-oe-id="%s">#%s</a></div>') % (self.id, self.name,)
self.message_post(body=notification, message_type="notification", subtype="mail.mt_comment")
if self.channel_type == 'channel':
notification = _('<div class="o_mail_notification">joined <a href="#" class="o_channel_redirect" data-oe-id="%s">#%s</a></div>') % (self.id, self.name,)
self.message_post(body=notification, message_type="notification", subtype="mail.mt_comment")
else:
self.channel_last_seen_partner_ids.write({'is_pinned': True})
self.action_follow()
channel_info = self.channel_info()[0]
+3 -2
View File
@@ -69,7 +69,7 @@ function make_message (data) {
var msg = {
id: data.id,
author_id: data.author_id,
body: data.body,
body: data.body || "",
date: data.date,
message_type: data.message_type,
is_note: data.is_note,
@@ -418,7 +418,7 @@ function on_mark_as_unread_notification (data) {
function on_chat_session_notification (chat_session) {
if ((chat_session.channel_type === "channel") && (chat_session.public === "private") && (chat_session.state === "open")) {
add_channel(chat_session, {autoswitch: false, silent: true, hidden: true});
add_channel(chat_session, {autoswitch: false});
if (!chat_session.is_minimized) {
web_client.do_notify(_t("Private Channel"), _t("You have been invited to: ") + chat_session.name);
}
@@ -557,6 +557,7 @@ var chat_manager = {
}
return def.then(function () {
channels = _.without(channels, channel);
delete channel_defs[channel.id];
});
},
close_chat_session: function (channel_id) {
+14 -7
View File
@@ -223,12 +223,12 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
render_sidebar: function () {
var self = this;
var $sidebar = QWeb.render("mail.chat.Sidebar", {
var $sidebar = $(QWeb.render("mail.chat.Sidebar", {
active_channel_id: this.channel ? this.channel.id: undefined,
channels: chat_manager.get_channels(),
needaction_counter: chat_manager.get_needaction_counter(),
});
this.$(".o_mail_chat_sidebar").replaceWith($sidebar);
}));
this.$(".o_mail_chat_sidebar").html($sidebar.contents());
this.$('.o_mail_add_channel[data-type=public]').find("input").autocomplete({
source: function(request, response) {
@@ -281,6 +281,16 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
});
},
render_snackbar: function (nb_needactions) {
this.$snackbar = $(QWeb.render('mail.chat.UndoSnackbar', {
nb_needactions: nb_needactions,
}));
this.$('.o_mail_chat_content').append(this.$snackbar);
// Hide snackbar after 20s
var $snackbar = this.$snackbar;
setTimeout(function() { $snackbar.fadeOut(); }, 20000);
},
do_search_channel: function(search_val){
var Channel = new Model("mail.channel");
return Channel.call('channel_search_to_join', [search_val]).then(function(result){
@@ -334,10 +344,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
if (channel.type !== 'static') {
// Display snackbar if needactions have been cleared
if (channel.needaction_counter > 0) {
self.$snackbar = $(QWeb.render('mail.chat.UndoSnackbar', {
nb_needactions: channel.needaction_counter,
}));
self.$('.o_mail_chat_content').append(self.$snackbar);
self.render_snackbar(channel.needaction_counter);
}
chat_manager.mark_channel_as_seen(channel);
self.clear_needactions_def = chat_manager.mark_all_as_read(channel);
@@ -105,9 +105,13 @@
.o-position-absolute(15px, 15px);
padding-top: 10px;
padding-bottom: 10px;
background-color: lighten(@odoo-brand-optional, 50%);
border-color: lighten(@odoo-brand-optional, 40%);
color: @odoo-brand-optional;
cursor: pointer;
background-color: darken(@gray, 8%);
color: white;
.o_snackbar_undo {
margin-left: 8px;
padding: 8px;
}
}
}
}
+3 -1
View File
@@ -8,7 +8,8 @@
}
.o_thread_date_separator {
margin-bottom: 15px;
margin-top: 15px;
margin-bottom: 30px;
border-bottom: solid @gray-lighter 2px;
text-align: center;
@@ -23,6 +24,7 @@
}
.o_thread_new_messages_separator {
margin-bottom: 15px;
border-bottom: solid lighten(@odoo-brand-primary, 15%) 1px;
text-align: right;
.o_thread_separator_label {
+2 -5
View File
@@ -91,11 +91,8 @@
</t>
<t t-name="mail.chat.UndoSnackbar">
<div class="alert alert-dismissible o_mail_snackbar" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&amp;times;</span>
</button>
<t t-esc="nb_needactions"/> message(s) marked as read.
<div class="alert o_mail_snackbar" data-dismiss="alert" role="alert">
<t t-esc="nb_needactions"/> mention(s) marked as read.
<a href="#" class="alert-link o_snackbar_undo">Undo</a>
</div>
</t>