Commit c608958e authored by JC Brand's avatar JC Brand

Handle special case of two `@` signs preceding a nickname

parent f86efca9
......@@ -170,6 +170,12 @@ describe("A sent groupchat message", function () {
expect(references)
.toEqual([{"begin":3,"end":8,"value":"robot","type":"mention","uri":"xmpp:robot@montague.lit"}]);
[text, references] = view.model.parseTextForReferences('@@gh0st')
expect(text).toBe('@gh0st');
expect(references.length).toBe(1);
expect(references)
.toEqual([{"begin":1,"end":6,"value":"gh0st","type":"mention","uri":"xmpp:lounge@montague.lit/gh0st"}]);
[text, references] = view.model.parseTextForReferences('hello z3r0')
expect(references.length).toBe(0);
expect(text).toBe('hello z3r0');
......
......@@ -996,7 +996,10 @@ converse.plugins.add('converse-muc', {
};
const matchToReference = match => {
const at_sign_index = match[0].indexOf('@');
let at_sign_index = match[0].indexOf('@');
if (match[0][at_sign_index+1] === '@') { // edge-case
at_sign_index += 1;
}
const begin = match.index + at_sign_index;
const end = begin + match[0].length - at_sign_index;
const value = getMatchingNickname(match[1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment