[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
This commit is contained in:
Aaron Bohy
2015-11-23 16:29:08 +01:00
parent 00630c5fd7
commit faf5cea948
6 changed files with 25 additions and 11 deletions
+5 -3
View File
@@ -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 = _('<div class="o_mail_notification">left <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 not self.email_send:
notification = _('<div class="o_mail_notification">left <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")
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 = _('<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")
self.action_follow()
+7 -4
View File
@@ -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);
}
+1 -1
View File
@@ -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;
}
});
@@ -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;
+4 -2
View File
@@ -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)
// ------------------------------------------------------------------
+3 -1
View File
@@ -78,7 +78,9 @@
<div t-if="channel.type === channel_type" t-att-data-channel-id="channel.id"
t-attf-class="o_mail_chat_channel_item #{channel.unread_counter ? ' o_unread_message' : ''} #{(active_channel_id == channel.id) ? 'o_active': ''}">
<span><i t-if="display_status" t-att-class="'o_user_status fa ' + (channel.status == 'online' ? 'fa-circle' : 'fa-circle-o')"/></span>
<span t-if="display_hash" class="o_mail_hash">#</span> <t t-esc="channel.name"/>
<span t-if="display_hash" class="o_mail_hash">#</span>
<t t-esc="channel.name"/>
<i t-if="channel.mass_mailing" class="fa fa-envelope-o"/>
<t t-call="mail.chat.SidebarNeedaction"/>
<span t-attf-class="fa fa-times pull-right o_mail_partner_unpin #{counter ? 'hide' : ''}"
t-att-title="_t('Close')" t-att-data-channel-id="channel.id"/>