[FIX] mail: messages sent as reply to previously selected message
In Discuss, if a message was selected as message to reply to, it wasn't reset when switching to another channel. So if the user sent a message in that other channel, the message was sent as reply to the previously selected message. This rev. ensures to always unselect messages when switching between channels. Closes #11879
This commit is contained in:
@@ -272,12 +272,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;
|
||||
},
|
||||
@@ -413,10 +414,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 + ']')
|
||||
@@ -432,14 +429,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,
|
||||
|
||||
Reference in New Issue
Block a user