[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<&>\"`' <&>"`' ツ")
```
opw-1909300
closes #29098
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user