[IMP] mail: sidebar autocomplete: redirect to already opened DM

Before this rev., if the user clicked, in the autocomplete dropdown, on an
already opened DM, nothing happened. Now, it redirects to that DM.

Also clear the input once a partner is selected.
This commit is contained in:
Aaron Bohy
2016-04-28 10:56:32 +02:00
parent 33beee5b08
commit 89939249e5
+9 -1
View File
@@ -339,7 +339,15 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
},
select: function(event, ui) {
var partner_id = ui.item.id;
chat_manager.create_channel(partner_id, "dm");
var dm = chat_manager.get_dm_from_partner_id(partner_id);
if (dm) {
self.set_channel(dm);
} else {
chat_manager.create_channel(partner_id, "dm");
}
// clear the input
$(this).val('');
return false;
},
focus: function(event) {
event.preventDefault();