[FIX] mail: various improvements/fixes

- display appropriate message when no results are found in a search
- don't display 'you have been invited' notif when creating private channel
- correctly join when a user was invited in a public channel
- display a message when a user join a channel through an invitation
- don't display subject for message of type notification (still a
  mystery why it happens in test.odoo.com for channel of type mailing)
- better heuristic on when to display message subject
- tweak sidebar text color (slightly whiter)
- add ... to the placeholder of the text area in the composer
- invert send and icons for attach/smiley in composer
- don't display 'read less' on expanded messages
- exclude livechat channels from channel mention suggestions
This commit is contained in:
Géry Debongnie
2015-11-27 11:47:34 +01:00
committed by Aaron Bohy
parent db8203c27a
commit 2c84cd4181
8 changed files with 23 additions and 14 deletions
+6 -3
View File
@@ -166,7 +166,6 @@ class Channel(models.Model):
self.message_post(body=notification, message_type="notification", subtype="mail.mt_comment")
return result
@api.multi
def message_get_email_values(self, notif_mail=None):
self.ensure_one()
@@ -423,6 +422,10 @@ class Channel(models.Model):
for channel in self:
partners_to_add = partners - channel.channel_partner_ids
channel.write({'channel_last_seen_partner_ids': [(0, 0, {'partner_id': partner_id}) for partner_id in partners_to_add.ids]})
for partner in partners_to_add:
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", author_id=partner.id)
# broadcast the channel header to the added partner
self._broadcast(partner_ids)
@@ -525,7 +528,7 @@ class Channel(models.Model):
'email_send': False,
'channel_partner_ids': [(4, self.env.user.partner_id.id)]
})
channel_info = new_channel.channel_info()[0]
channel_info = new_channel.channel_info('creation')[0]
notification = _('<div class="o_mail_notification">created <a href="#" class="o_channel_redirect" data-oe-id="%s">#%s</a></div>') % (new_channel.id, new_channel.name,)
new_channel.message_post(body=notification, message_type="notification", subtype="mail.mt_comment")
self.env['bus.bus'].sendone((self._cr.dbname, 'res.partner', self.env.user.partner_id.id), channel_info)
@@ -538,7 +541,7 @@ class Channel(models.Model):
user isn't registered to. """
domain = expression.AND([
[('name', 'ilike', search)],
[('channel_type', '!=', 'chat')],
[('channel_type', '=', 'channel')],
expression.OR([
[('public', '!=', 'private')],
[('channel_partner_ids', 'in', [self.env.user.partner_id.id])]
+3 -3
View File
@@ -489,10 +489,10 @@ 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")) {
if ((chat_session.channel_type === "channel") && (chat_session.state === "open")) {
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);
if (!chat_session.is_minimized && chat_session.info !== 'creation') {
web_client.do_notify(_t("Invitation"), _t("You have been invited to: ") + chat_session.name);
}
}
// partner specific change (open a detached window for example)
@@ -422,6 +422,9 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
display_needactions: this.channel.display_needactions,
messages_separator_position: this.messages_separator_position,
squash_close_messages: this.channel.type !== 'static',
display_empty_channel: !messages.length && !this.domain.length,
display_no_match: !messages.length && this.domain.length,
display_subject: this.channel.mass_mailing || this.channel.id === "channel_inbox",
};
},
+1 -1
View File
@@ -77,7 +77,7 @@ var Thread = Widget.extend({
this.$el.html(QWeb.render('mail.ChatThread', {
messages: msgs,
options: _.extend({}, this.options, options),
options: options,
ORDER: ORDER,
}));
},
@@ -128,7 +128,7 @@
.o_mail_chat {
.o_mail_chat_sidebar {
background-color: darken(@gray, 8%);
color: lighten(@gray, 50%);
color: lighten(@gray, 60%);
opacity: 0.9;
.o_mail_chat_channel_item {
+1 -1
View File
@@ -53,7 +53,7 @@
</t>
<!-- Add a button to open the full composer dialog -->
<t t-jquery=".o_composer_buttons" t-operation="append">
<t t-jquery=".o_composer_button_add_attachment" t-operation="after">
<button class="btn btn-sm btn-icon fa fa-pencil-square-o o_composer_button_full_composer" type="button"/>
</t>
</t>
+2 -2
View File
@@ -4,11 +4,11 @@
<div t-name="mail.ChatComposer" class="o_chat_composer">
<div class="o_composer_attachments_list"/>
<div class="o_composer">
<textarea class="o_composer_input" placeholder="Write something"/>
<textarea class="o_composer_input" placeholder="Write something..."/>
<div class="btn-group o_composer_buttons">
<button class="btn btn-sm btn-primary o_composer_button_send" type="button">Send</button>
<button class="btn btn-sm btn-icon fa fa-smile-o o_composer_button_emoji" type="button" data-toggle="popover"/>
<button class="btn btn-sm btn-icon fa fa-paperclip o_composer_button_add_attachment" type="button"/>
<button class="btn btn-sm btn-primary o_composer_button_send" type="button">Send</button>
</div>
</div>
+6 -3
View File
@@ -9,9 +9,13 @@
<t t-if="options.display_load_more &amp;&amp; options.display_order == ORDER.DESC"
t-call="mail.ChatThread.LoadMore"/>
</t>
<t t-if="!messages.length &amp;&amp; options.display_help">
<t t-if="options.display_empty_channel">
<t t-call="mail.EmptyChannel" />
</t>
<t t-if="options.display_no_match">
<div class="o_thread_title">No matches found</div>
<div>No message matches your search. Try to change your search filters.</div>
</t>
</t>
<!-- When a channel is empty-->
@@ -107,7 +111,7 @@
</t>
<t t-call="mail.ChatThread.MessageTracking"/>
</t>
<p t-if="message.subject" class="o_mail_subject">Subject: <t t-esc="message.subject"/></p>
<p t-if="options.display_subject &amp;&amp; message.subject &amp;&amp; message.message_type != 'notification'" class="o_mail_subject">Subject: <t t-esc="message.subject"/></p>
<t t-if="!(message.tracking_value_ids &amp;&amp; message.tracking_value_ids.length &gt; 0)">
<t t-if="message.body_short">
<div class="o_mail_body_short">
@@ -115,7 +119,6 @@
</div>
<div class="o_mail_body_long">
<t t-raw="message.body"/>
<span class="oe_mail_expand"><a href="#">... read less</a></span>
</div>
</t>
<t t-if="! message.body_short">