[FIX] mail: Cannot send new message from Event Track
When the Speaker address is False, it crashed. opw:805361
This commit is contained in:
@@ -111,7 +111,7 @@ var ChatterComposer = composer.BasicComposer.extend({
|
||||
.done(function (suggested_recipients) {
|
||||
var thread_recipients = suggested_recipients[self.context.default_res_id];
|
||||
_.each(thread_recipients, function (recipient) {
|
||||
var parsed_email = utils.parse_email(recipient[1]);
|
||||
var parsed_email = recipient[1] && utils.parse_email(recipient[1]);
|
||||
if (_.indexOf(email_addresses, parsed_email[1]) === -1) {
|
||||
self.suggested_partners.push({
|
||||
checked: true,
|
||||
@@ -188,8 +188,8 @@ var ChatterComposer = composer.BasicComposer.extend({
|
||||
context: {
|
||||
force_email: true,
|
||||
ref: "compound_context",
|
||||
default_name: parsed_email[0],
|
||||
default_email: parsed_email[1],
|
||||
default_name: parsed_email && parsed_email[0],
|
||||
default_email: parsed_email && parsed_email[1],
|
||||
},
|
||||
title: _t("Please complete partner's informations"),
|
||||
disable_multiple_selection: true,
|
||||
|
||||
@@ -101,15 +101,17 @@ function inline (node, transform_children) {
|
||||
|
||||
// Parses text to find email: Tagada <address@mail.fr> -> [Tagada, address@mail.fr] or False
|
||||
function parse_email (text) {
|
||||
var result = text.match(/(.*)<(.*@.*)>/);
|
||||
if (result) {
|
||||
return [_.str.trim(result[1]), _.str.trim(result[2])];
|
||||
if (text){
|
||||
var result = text.match(/(.*)<(.*@.*)>/);
|
||||
if (result) {
|
||||
return [_.str.trim(result[1]), _.str.trim(result[2])];
|
||||
}
|
||||
result = text.match(/(.*@.*)/);
|
||||
if (result) {
|
||||
return [_.str.trim(result[1]), _.str.trim(result[1])];
|
||||
}
|
||||
return [text, false];
|
||||
}
|
||||
result = text.match(/(.*@.*)/);
|
||||
if (result) {
|
||||
return [_.str.trim(result[1]), _.str.trim(result[1])];
|
||||
}
|
||||
return [text, false];
|
||||
}
|
||||
|
||||
// Replaces textarea text into html text (add <p>, <a>)
|
||||
|
||||
Reference in New Issue
Block a user