[FIX] mail: href of mention links in sent messages

Those messages can be read from the client action interface, where the onclick
redirection is properly handled, but they are also sent by email. The
generated links should thus have a correct href.
This commit is contained in:
Aaron Bohy
2015-12-03 11:21:47 +01:00
parent e7cb3dcaa8
commit 7bea8412c5
+4 -2
View File
@@ -218,7 +218,8 @@ var MentionManager = Widget.extend({
*/
generate_links: function (s) {
var self = this;
var mention_link = "<a href='#' class='%s' data-oe-id='%s' data-oe-model='%s'>%s%s</a>";
var base_href = session.url("/web");
var mention_link = "<a href='%s' class='%s' data-oe-id='%s' data-oe-model='%s' target='_blank'>%s%s</a>";
_.each(this.listeners, function (listener) {
var selection = listener.selection;
if (selection.length) {
@@ -229,7 +230,8 @@ var MentionManager = Widget.extend({
var match = matches[i];
var end_index = match.index + match[0].length;
var match_name = match[0].substring(1);
var processed_text = _.str.sprintf(mention_link, listener.redirect_classname, selection[i].id, listener.model, listener.delimiter, match_name);
var href = base_href + _.str.sprintf("#model=%s&id=%s", listener.model, selection[i].id);
var processed_text = _.str.sprintf(mention_link, href, listener.redirect_classname, selection[i].id, listener.model, listener.delimiter, match_name);
var subtext = s.substring(start_index, end_index).replace(match[0], processed_text);
substrings.push(subtext);
start_index = end_index;