From faf5cea9480bfdd0635bccbc3a9ea88c19ceeb64 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 18 Nov 2015 11:16:18 +0100 Subject: [PATCH] [FIX] mail: various UI improvements - emoji are no more clickable in threads (they are only in the popover) - correctly update channel needaction counter - don't display 'New message' notification when the channel in detached - display in the ui channels that send emails and other channels - prevent notifications in mass mailing channels - increase bottom padding in client action thread --- addons/mail/models/mail_channel.py | 8 +++++--- addons/mail/static/src/js/chat_manager.js | 11 +++++++---- addons/mail/static/src/js/window_manager.js | 2 +- addons/mail/static/src/less/client_action.less | 5 +++++ addons/mail/static/src/less/composer.less | 6 ++++-- addons/mail/static/src/xml/client_action.xml | 4 +++- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index 2b3332b42aa..101670e8630 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -161,8 +161,9 @@ class Channel(models.Model): def action_unfollow(self): result = self.write({'channel_partner_ids': [(3, self.env.user.partner_id.id)]}) self.env['bus.bus'].sendone((self._cr.dbname, 'res.partner', self.env.user.partner_id.id), self.channel_info('unsubscribe')[0]) - notification = _('
left #%s
') % (self.id, self.name,) - self.message_post(body=notification, message_type="notification", subtype="mail.mt_comment") + if not self.email_send: + notification = _('
left #%s
') % (self.id, self.name,) + self.message_post(body=notification, message_type="notification", subtype="mail.mt_comment") return result @@ -281,6 +282,7 @@ class Channel(models.Model): 'is_minimized': False, 'channel_type': channel.channel_type, 'public': channel.public, + 'mass_mailing': channel.email_send, } if extra_info: info['info'] = extra_info @@ -500,7 +502,7 @@ class Channel(models.Model): @api.multi def channel_join_and_get_info(self): self.ensure_one() - if self.channel_type == 'channel': + if self.channel_type == 'channel' and not self.email_send: notification = _('
joined #%s
') % (self.id, self.name,) self.message_post(body=notification, message_type="notification", subtype="mail.mt_comment") self.action_follow() diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index d16683d3647..239291628f0 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -200,6 +200,7 @@ function make_channel (data, options) { autoswitch: 'autoswitch' in options ? options.autoswitch : true, hidden: options.hidden, display_needactions: options.display_needactions, + mass_mailing: data.mass_mailing, needaction_counter: data.message_needaction_counter || 0, unread_counter: data.message_unread_counter || 0, last_seen_message_id: data.seen_message_id, @@ -330,10 +331,12 @@ function on_notification (notification) { function on_needaction_notification (message) { message = add_message(message, { channel_id: 'channel_inbox', show_notification: true} ); needaction_counter++; - var channel = chat_manager.get_channel(message.channel_ids[0]); - if (channel) { - channel.needaction_counter++; - } + _.each(message.channel_ids, function (channel_id) { + var channel = chat_manager.get_channel(channel_id); + if (channel) { + channel.needaction_counter++; + } + }); chat_manager.bus.trigger('update_needaction', needaction_counter); } diff --git a/addons/mail/static/src/js/window_manager.js b/addons/mail/static/src/js/window_manager.js index aacf2a2919f..2326ef14dc2 100644 --- a/addons/mail/static/src/js/window_manager.js +++ b/addons/mail/static/src/js/window_manager.js @@ -100,7 +100,7 @@ core.bus.on('web_client_ready', null, function () { chat_manager.bus.on('anyone_listening', null, function (channel, query) { _.each(chat_sessions, function (session) { - if (_.contains(channel.id, session.id)) { + if (channel.id === session.id) { query.is_displayed = true; } }); diff --git a/addons/mail/static/src/less/client_action.less b/addons/mail/static/src/less/client_action.less index 5e077caedd2..64f0afe507a 100644 --- a/addons/mail/static/src/less/client_action.less +++ b/addons/mail/static/src/less/client_action.less @@ -47,6 +47,10 @@ .o_mail_partner_unpin { padding: 2px 6px; } + i.fa-envelope-o { + margin-left: 3px; + } + } .o_mail_add_channel { width: 100%; @@ -76,6 +80,7 @@ .o-flex(1, 0, 0); overflow: auto; .o-webclient-padding(); + padding-bottom: 15px; .o_chat_help_message { padding: 25px 0; diff --git a/addons/mail/static/src/less/composer.less b/addons/mail/static/src/less/composer.less index f44d8b381d4..11cfbae04d3 100644 --- a/addons/mail/static/src/less/composer.less +++ b/addons/mail/static/src/less/composer.less @@ -7,17 +7,19 @@ text-align: justify; } -// Emoji size in the popover +// Emoji .o_mail_emoji { display: inline-block; height: 24px; width: 24px; > img { - cursor: pointer; width: 100%; } } +.o_composer_emoji .o_mail_emoji { + cursor: pointer; // only in the popover +} // Attachment Icons (common for chat thread and chat composer) // ------------------------------------------------------------------ diff --git a/addons/mail/static/src/xml/client_action.xml b/addons/mail/static/src/xml/client_action.xml index 89d7395073d..e3c2c1aeee2 100644 --- a/addons/mail/static/src/xml/client_action.xml +++ b/addons/mail/static/src/xml/client_action.xml @@ -78,7 +78,9 @@
- # + # + +