[FIX] mail: mention escape let original intact

When selecting a mention we will add a mention in a list of selection
from the list of mention.

In 10f0766b3 that mention in list of selection was escaped so this would
match the text that would be escaped when the mention was searched in
it.

But the object are the same so the change modified the original list.

Modified test failed with:

```
  10. first partner mention should still display the correct partner
      name (Expected: "ЅpëciãlUser<&>\"`' ツ" Result:
      "ЅpëciãlUser<&>\"`' &lt;&amp;&gt;&quot;&#x60;&#x27; ツ")
```

opw-1909300
closes #29098
This commit is contained in:
Nicolas Lempereur
2018-11-28 12:33:17 +00:00
parent 3b0a6a6c35
commit dbe0337555
2 changed files with 9 additions and 3 deletions
@@ -378,9 +378,9 @@ var MentionManager = Widget.extend({
var textInput = this._composer.$input.val();
var id = $(ev.currentTarget).data('id');
var suggestions = _.flatten(this.get('mention_suggestions'));
var selectedSuggestion = _.find(suggestions, function (s) {
var selectedSuggestion = _.clone(_.find(suggestions, function (s) {
return s.id === id;
});
}));
var substitution = selectedSuggestion.substitution;
if (!substitution) {
// no substitution string given, so use the mention name instead
+7 -1
View File
@@ -424,7 +424,7 @@ QUnit.test('@ mention in channel', function (assert) {
});
QUnit.test('@ mention with special chars', function (assert) {
assert.expect(9);
assert.expect(10);
var done = assert.async();
var fetchListenersDef = $.Deferred();
var receiveMessageDef = $.Deferred();
@@ -506,6 +506,12 @@ QUnit.test('@ mention with special chars', function (assert) {
assert.strictEqual(discuss.$('.o_thread_message_content a').text(),
"@\u0405pëciãlUser<&>\"`' \u30C4",
"should have correct mention link in the message content");
$input.val("@");
$input.trigger('keyup');
var $mention = discuss.$('.o_mention_proposition');
assert.strictEqual($mention.find('.o_mention_name').text(),
'\u0405pëciãlUser<&>"`\' \u30C4',
"first partner mention should still display the correct partner name");
discuss.destroy();
done();
});