Handle special case of two @
signs preceding a nickname
This commit is contained in:
parent
f86efca9a6
commit
c608958eb3
@ -170,6 +170,12 @@ describe("A sent groupchat message", function () {
|
|||||||
expect(references)
|
expect(references)
|
||||||
.toEqual([{"begin":3,"end":8,"value":"robot","type":"mention","uri":"xmpp:robot@montague.lit"}]);
|
.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')
|
[text, references] = view.model.parseTextForReferences('hello z3r0')
|
||||||
expect(references.length).toBe(0);
|
expect(references.length).toBe(0);
|
||||||
expect(text).toBe('hello z3r0');
|
expect(text).toBe('hello z3r0');
|
||||||
|
@ -996,7 +996,10 @@ converse.plugins.add('converse-muc', {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const matchToReference = match => {
|
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 begin = match.index + at_sign_index;
|
||||||
const end = begin + match[0].length - at_sign_index;
|
const end = begin + match[0].length - at_sign_index;
|
||||||
const value = getMatchingNickname(match[1]);
|
const value = getMatchingNickname(match[1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user