summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-05-04 17:09:51 +0200
committerChristophe Simonis <chs@odoo.com>2016-05-04 17:09:51 +0200
commit0fbc92e0c4c07d61da55d0bbb3cadd55f51dc4d7 (patch)
tree4be569ab0f86370fe9044a9b13d69c858c980de0 /addons/mail/static/src/js
parent858188f1a2a2207cf93cc0f2d0d2deb08bb7dbf6 (diff)
parent1e86774207d09c901c61b148c5c0c23a511aa282 (diff)
[MERGE] forward port of branch saas-10 up to 1e86774
Diffstat (limited to 'addons/mail/static/src/js')
-rw-r--r--addons/mail/static/src/js/client_action.js21
-rw-r--r--addons/mail/static/src/js/composer.js2
-rw-r--r--addons/mail/static/src/js/systray.js4
3 files changed, 11 insertions, 16 deletions
diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js
index 7870f79041c..f090cb5a4a6 100644
--- a/addons/mail/static/src/js/client_action.js
+++ b/addons/mail/static/src/js/client_action.js
@@ -287,12 +287,13 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
},
unselect_message: function() {
- if (this.channel.type !== 'static' && !this.channel.mass_mailing) {
- this.basic_composer.toggle(true);
- this.basic_composer.focus();
+ this.basic_composer.toggle(this.channel.type !== 'static' && !this.channel.mass_mailing);
+ this.extended_composer.toggle(this.channel.type !== 'static' && this.channel.mass_mailing);
+ if (!config.device.touch) {
+ var composer = this.channel.mass_mailing ? this.extended_composer : this.basic_composer;
+ composer.focus();
}
this.$el.removeClass('o_mail_selection_mode');
- this.extended_composer.toggle(this.channel.mass_mailing);
this.thread.unselect();
this.selected_message = null;
},
@@ -436,10 +437,6 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
.find('.o_mail_chat_button_unstar_all')
.toggle(channel.id === "channel_starred");
- self.basic_composer.toggle(channel.type !== 'static' && !channel.mass_mailing);
- self.extended_composer.toggle(channel.type !== 'static' && channel.mass_mailing);
- self.$el.removeClass('o_mail_selection_mode');
-
self.$('.o_mail_chat_channel_item')
.removeClass('o_active')
.filter('[data-channel-id=' + channel.id + ']')
@@ -455,14 +452,14 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
// Update control panel before focusing the composer, otherwise focus is on the searchview
self.update_cp();
- if (!config.device.touch) {
- var composer = channel.mass_mailing ? self.extended_composer : self.basic_composer;
- composer.focus();
- }
if (config.device.size_class === config.device.SIZES.XS) {
self.$('.o_mail_chat_sidebar').hide();
}
+ // Display and focus the adequate composer, and unselect possibly selected message
+ // to prevent sending messages as reply to that message
+ self.unselect_message();
+
self.action_manager.do_push_state({
action: self.action.id,
active_id: self.channel.id,
diff --git a/addons/mail/static/src/js/composer.js b/addons/mail/static/src/js/composer.js
index 0edfe170011..cfe65656b08 100644
--- a/addons/mail/static/src/js/composer.js
+++ b/addons/mail/static/src/js/composer.js
@@ -676,7 +676,7 @@ var BasicComposer = Widget.extend({
// filter prefetched partners with the given search string
var suggestions = [];
var limit = self.options.mention_fetch_limit;
- var search_regexp = new RegExp(utils.unaccent(search), 'i');
+ var search_regexp = new RegExp(_.str.escapeRegExp(utils.unaccent(search)), 'i');
_.each(prefetched_partners, function (partners) {
if (limit > 0) {
var filtered_partners = _.filter(partners, function (partner) {
diff --git a/addons/mail/static/src/js/systray.js b/addons/mail/static/src/js/systray.js
index b3514e4ccb4..aa8c10a0c04 100644
--- a/addons/mail/static/src/js/systray.js
+++ b/addons/mail/static/src/js/systray.js
@@ -110,9 +110,7 @@ var MessagingMenu = Widget.extend({
// Generate last message preview (inline message body and compute date to display)
_.each(channels_preview, function (channel) {
- channel.last_message_preview =
- channel.last_message.displayed_author + ': ' +
- chat_manager.get_message_body_preview(channel.last_message.body);
+ channel.last_message_preview = chat_manager.get_message_body_preview(channel.last_message.body);
if (channel.last_message.date.isSame(new Date(), 'd')) { // today
channel.last_message_date = channel.last_message.date.format('LT');
} else {