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
4018dd95
Commit
4018dd95
authored
Jan 09, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1764: Incorrect URI encoding in references
parent
2dae07fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
2 deletions
+46
-2
CHANGES.md
CHANGES.md
+1
-0
spec/muc_messages.js
spec/muc_messages.js
+43
-0
src/headless/converse-muc.js
src/headless/converse-muc.js
+2
-2
No files found.
CHANGES.md
View file @
4018dd95
...
...
@@ -29,6 +29,7 @@
-
#1666: Allow scrolling of the OMEMO fingerprints list
-
#1691: Fix
`collection.chatbox is undefined`
errors
-
#1767:
`credentials_url`
is not called when logging out and then in again
-
#1764: Incorrect URI encoding in "mention" references
-
#1772:
`_converse.api.contact.add(jid, nick)`
fails, says not a function
-
#1791:
`auto_focus`
set to
`false`
is ignored when switching back to a MUC
-
#1792: Fix: modals don't have scrollbars
...
...
spec/muc_messages.js
View file @
4018dd95
...
...
@@ -915,7 +915,50 @@
[
text
,
references
]
=
view
.
model
.
parseTextForReferences
(
'
nice website https://darnuria.eu/@darnuria
'
);
expect
(
references
.
length
).
toBe
(
0
);
expect
(
text
).
toBe
(
'
nice website https://darnuria.eu/@darnuria
'
);
done
();
}));
it
(
"
properly encodes the URIs in sent out references
"
,
mock
.
initConverse
(
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
const
muc_jid
=
'
lounge@montague.lit
'
;
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
muc_jid
,
'
tom
'
);
const
view
=
_converse
.
api
.
roomviews
.
get
(
muc_jid
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
$pres
({
'
to
'
:
'
tom@montague.lit/resource
'
,
'
from
'
:
`lounge@montague.lit/Link Mauve`
})
.
c
(
'
x
'
,
{
xmlns
:
Strophe
.
NS
.
MUC_USER
})
.
c
(
'
item
'
,
{
'
affiliation
'
:
'
none
'
,
'
role
'
:
'
participant
'
})));
const
textarea
=
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
);
textarea
.
value
=
'
hello @Link Mauve
'
const
enter_event
=
{
'
target
'
:
textarea
,
'
preventDefault
'
:
function
preventDefault
()
{},
'
stopPropagation
'
:
function
stopPropagation
()
{},
'
keyCode
'
:
13
// Enter
}
spyOn
(
_converse
.
connection
,
'
send
'
);
view
.
onKeyDown
(
enter_event
);
await
new
Promise
(
resolve
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
const
msg
=
_converse
.
connection
.
send
.
calls
.
all
()[
0
].
args
[
0
];
expect
(
msg
.
toLocaleString
())
.
toBe
(
`<message from="romeo@montague.lit/orchard" id="
${
msg
.
nodeTree
.
getAttribute
(
"
id
"
)}
" `
+
`to="lounge@montague.lit" type="groupchat" `
+
`xmlns="jabber:client">`
+
`<body>hello Link Mauve</body>`
+
`<active xmlns="http://jabber.org/protocol/chatstates"/>`
+
`<reference begin="6" end="16" type="mention" uri="xmpp:lounge@montague.lit/Link%20Mauve" xmlns="urn:xmpp:reference:0"/>`
+
`<origin-id id="
${
msg
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
done
();
}));
...
...
src/headless/converse-muc.js
View file @
4018dd95
...
...
@@ -786,9 +786,9 @@ converse.plugins.add('converse-muc', {
'
type
'
:
'
mention
'
};
if
(
occupant
.
get
(
'
jid
'
))
{
obj
.
uri
=
`xmpp:
${
occupant
.
get
(
'
jid
'
)}
`
;
obj
.
uri
=
encodeURI
(
`xmpp:
${
occupant
.
get
(
'
jid
'
)}
`
)
;
}
else
{
obj
.
uri
=
`xmpp:
${
this
.
get
(
'
jid
'
)}
/
${
occupant
.
get
(
'
nick
'
)}
`
;
obj
.
uri
=
encodeURI
(
`xmpp:
${
this
.
get
(
'
jid
'
)}
/
${
occupant
.
get
(
'
nick
'
)}
`
)
;
}
return
obj
;
},
...
...
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