Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
c608958e
Commit
c608958e
authored
Nov 27, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle special case of two `@` signs preceding a nickname
parent
f86efca9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
spec/mentions.js
spec/mentions.js
+6
-0
src/headless/converse-muc.js
src/headless/converse-muc.js
+4
-1
No files found.
spec/mentions.js
View file @
c608958e
...
...
@@ -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
'
);
...
...
src/headless/converse-muc.js
View file @
c608958e
...
...
@@ -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
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment