diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2017-01-24 09:31:31 +0100 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2017-01-25 15:47:30 +0100 |
| commit | 7427825790daff2ee6d6b1db8c7ea73c29f7f7bc (patch) | |
| tree | a04828e4683b71019c74390a8e971e791c3fe88f /addons/mail/static/src | |
| parent | 6a7db305084ef556dac7895ea4fa12e00bf078d8 (diff) | |
[FIX] mail: don't linkify removed mention
If after inserting a mention (eg: `@Guy`) and we eg. backspace and
change it (eg: to `@GuyFawkes`) the `@Guy` mention will still be
linkified but the partner is not subscribed.
This happened because the linkifying was not requiring a space to follow
the mention, but when getting the used mentions (and commands, ...) in
the message they were required (unless the mention was exactly at the
end of the message).
With this commit, a space is always required after a mention for it to
be working.
opw-705267
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/js/composer.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mail/static/src/js/composer.js b/addons/mail/static/src/js/composer.js index 6560e76fb13..21a4124ee54 100644 --- a/addons/mail/static/src/js/composer.js +++ b/addons/mail/static/src/js/composer.js @@ -130,7 +130,7 @@ var MentionManager = Widget.extend({ get_listener_selection: function (delimiter) { var listener = _.findWhere(this.listeners, {delimiter: delimiter}); if (listener) { - var input_mentions = this.composer.$input.val().match(new RegExp(delimiter+'[^ ]+', 'g')); + var input_mentions = this.composer.$input.val().match(new RegExp(delimiter+'[^ ]+(?= | )', 'g')); return this._validate_selection(listener.selection, input_mentions); } return []; @@ -270,7 +270,7 @@ var MentionManager = Widget.extend({ // create the regex of all mention's names var names = _.pluck(listener.selection, 'name'); var escaped_names = _.map(names, function (str) { - return "("+_.str.escapeRegExp(listener.delimiter+str)+")"; + return "("+_.str.escapeRegExp(listener.delimiter+str)+")(?= | )"; }); var regex_str = escaped_names.join('|'); // extract matches |
