diff options
| -rw-r--r-- | addons/im_livechat/static/src/js/im_livechat.js | 1 | ||||
| -rw-r--r-- | addons/mail/models/mail_message.py | 4 | ||||
| -rw-r--r-- | addons/mail/static/src/js/services/chat_manager.js | 2 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/thread.xml | 2 | ||||
| -rw-r--r-- | addons/mail/static/tests/chat_window_tests.js | 1 | ||||
| -rw-r--r-- | addons/mail/static/tests/chatter_tests.js | 2 |
6 files changed, 10 insertions, 2 deletions
diff --git a/addons/im_livechat/static/src/js/im_livechat.js b/addons/im_livechat/static/src/js/im_livechat.js index fddf5ec6c2c..b392d337d04 100644 --- a/addons/im_livechat/static/src/js/im_livechat.js +++ b/addons/im_livechat/static/src/js/im_livechat.js @@ -237,6 +237,7 @@ var LivechatButton = Widget.extend({ is_needaction: false, is_note: data.is_note, is_discussion: data.is_discussion, + is_notification: data.is_notification, customer_email_data: [] }; diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 989167905fd..4362358b864 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -392,8 +392,9 @@ class Message(models.Model): 'message_type': u'comment', 'id': 59, 'subject': False - 'is_note': True # only if the subtype is internal + 'is_note': True # only if the message is a note (subtype == note) 'is_discussion': False # only if the message is a discussion (subtype == discussion) + 'is_notification': False # only if the message is a note but is a notification aka not linked to a document like assignation } """ message_values = self.read([ @@ -419,6 +420,7 @@ class Message(models.Model): for message in message_values: message['is_note'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['id'] == note_id message['is_discussion'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['id'] == com_id + message['is_notification'] = message['is_note'] and not message['model'] and not message['res_id'] message['subtype_description'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['description'] if message['model'] and self.env[message['model']]._original_module: message['module_icon'] = modules.module.get_module_icon(self.env[message['model']]._original_module) diff --git a/addons/mail/static/src/js/services/chat_manager.js b/addons/mail/static/src/js/services/chat_manager.js index ea6c9388f58..1abcd995084 100644 --- a/addons/mail/static/src/js/services/chat_manager.js +++ b/addons/mail/static/src/js/services/chat_manager.js @@ -1314,6 +1314,7 @@ var ChatManager = AbstractService.extend({ * @param {string} [data.info] * @param {boolean} data.is_discussion * @param {boolean} data.is_note + * @param {boolean} data.is_notification * @param {string} data.message_type * @param {string} [data.model] * @param {boolean} data.module_icon src url of the module icon @@ -1336,6 +1337,7 @@ var ChatManager = AbstractService.extend({ is_author: data.author_id && data.author_id[0] === session.partner_id, is_note: data.is_note, is_discussion: data.is_discussion, + is_notification: data.is_notification, is_system_notification: (data.message_type === 'notification' && data.model === 'mail.channel') || data.info === 'transient_message', attachment_ids: data.attachment_ids || [], diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml index 1019b141b75..118e96da8ff 100644 --- a/addons/mail/static/src/xml/thread.xml +++ b/addons/mail/static/src/xml/thread.xml @@ -121,7 +121,7 @@ </t> <t t-name="mail.ChatThread.Message"> - <div t-att-class="'o_thread_message' + (message.expanded ? ' o_message_expanded ' : ' ') + (message.is_selected ? 'o_thread_selected_message' : '') + (message.is_discussion ? ' o_mail_discussion' : ' o_mail_not_discussion')" t-att-data-message-id="message.id"> + <div t-att-class="'o_thread_message' + (message.expanded ? ' o_message_expanded ' : ' ') + (message.is_selected ? 'o_thread_selected_message' : '') + (message.is_discussion or message.is_notification ? ' o_mail_discussion' : ' o_mail_not_discussion')" t-att-data-message-id="message.id"> <div t-if="options.display_avatar" class="o_thread_message_sidebar"> <t t-if="!message.mailto and message.author_id[0]"> <img t-if="message.avatar_src and message.display_author" diff --git a/addons/mail/static/tests/chat_window_tests.js b/addons/mail/static/tests/chat_window_tests.js index ab5a9f03538..05df8461d18 100644 --- a/addons/mail/static/tests/chat_window_tests.js +++ b/addons/mail/static/tests/chat_window_tests.js @@ -37,6 +37,7 @@ QUnit.module('mail', { id: 1, is_note: false, is_discussion: true, + is_notification: false, is_starred: false, model: 'partner', res_id: 2 diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js index 56ee5076479..8c1edc2f622 100644 --- a/addons/mail/static/tests/chatter_tests.js +++ b/addons/mail/static/tests/chatter_tests.js @@ -389,6 +389,7 @@ QUnit.test('chatter: post, receive and star messages', function (assert) { id: 1, is_note: false, is_discussion: true, + is_notification: false, is_starred: false, model: 'partner', res_id: 2, @@ -433,6 +434,7 @@ QUnit.test('chatter: post, receive and star messages', function (assert) { id: msg_id, is_note: args.kwargs.subtype === 'mail.mt_note', is_discussion: args.kwargs.subtype === 'mail.mt_comment', + is_notification: false, is_starred: false, model: 'partner', res_id: 2, |
