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
6cab7fcc
Commit
6cab7fcc
authored
Apr 16, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests due to refactoring
updates #161
parent
b889637f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
35 deletions
+34
-35
spec/chatbox.js
spec/chatbox.js
+20
-20
spec/otr.js
spec/otr.js
+2
-2
src/converse-chatview.js
src/converse-chatview.js
+0
-1
src/converse-otr.js
src/converse-otr.js
+12
-12
No files found.
spec/chatbox.js
View file @
6cab7fcc
...
@@ -416,7 +416,7 @@
...
@@ -416,7 +416,7 @@
expect
(
view
).
toBeDefined
();
expect
(
view
).
toBeDefined
();
var
$toolbar
=
$
(
view
.
el
).
find
(
'
ul.chat-toolbar
'
);
var
$toolbar
=
$
(
view
.
el
).
find
(
'
ul.chat-toolbar
'
);
expect
(
$toolbar
.
length
).
toBe
(
1
);
expect
(
$toolbar
.
length
).
toBe
(
1
);
expect
(
$toolbar
.
children
(
'
li
'
).
length
).
toBe
(
3
);
expect
(
$toolbar
.
children
(
'
li
'
).
length
).
toBe
(
2
);
done
();
done
();
}));
}));
...
@@ -754,7 +754,7 @@
...
@@ -754,7 +754,7 @@
'
time
'
:
moment
().
format
(),
'
time
'
:
moment
().
format
(),
'
message
'
:
msg_text
'
message
'
:
msg_text
});
});
view
.
sendMessage
(
message
);
view
.
model
.
sendMessage
(
message
);
var
$chat_content
=
$
(
view
.
el
).
find
(
'
.chat-content
'
);
var
$chat_content
=
$
(
view
.
el
).
find
(
'
.chat-content
'
);
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message:last
'
).
find
(
'
.chat-msg-content
'
).
text
();
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message:last
'
).
find
(
'
.chat-msg-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
msg_text
);
expect
(
msg_txt
).
toEqual
(
msg_text
);
...
@@ -770,7 +770,7 @@
...
@@ -770,7 +770,7 @@
'
time
'
:
moment
().
format
(),
'
time
'
:
moment
().
format
(),
'
message
'
:
msg_text
'
message
'
:
msg_text
});
});
view
.
sendMessage
(
message
);
view
.
model
.
sendMessage
(
message
);
msg_txt
=
$chat_content
.
find
(
'
.chat-message:last
'
).
find
(
'
.chat-msg-content
'
).
text
();
msg_txt
=
$chat_content
.
find
(
'
.chat-message:last
'
).
find
(
'
.chat-msg-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
msg_text
);
expect
(
msg_txt
).
toEqual
(
msg_text
);
...
@@ -1455,9 +1455,9 @@
...
@@ -1455,9 +1455,9 @@
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
chatBoxFocused
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
chatBoxFocused
'
,
jasmine
.
any
(
Object
));
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
message
=
'
This message is sent from this chatbox
'
;
var
message
=
'
This message is sent from this chatbox
'
;
spyOn
(
view
,
'
sendMessage
'
).
and
.
callThrough
();
spyOn
(
view
.
model
,
'
sendMessage
'
).
and
.
callThrough
();
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
messages
.
length
,
2
);
expect
(
view
.
model
.
messages
.
length
,
2
);
expect
(
_converse
.
emit
.
calls
.
mostRecent
().
args
,
[
'
messageSend
'
,
message
]);
expect
(
_converse
.
emit
.
calls
.
mostRecent
().
args
,
[
'
messageSend
'
,
message
]);
expect
(
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
message
);
expect
(
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
message
);
...
@@ -1476,9 +1476,9 @@
...
@@ -1476,9 +1476,9 @@
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
message
=
'
<p>This message contains <em>some</em> <b>markup</b></p>
'
;
var
message
=
'
<p>This message contains <em>some</em> <b>markup</b></p>
'
;
spyOn
(
view
,
'
sendMessage
'
).
and
.
callThrough
();
spyOn
(
view
.
model
,
'
sendMessage
'
).
and
.
callThrough
();
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<p>This message contains <em>some</em> <b>markup</b></p>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<p>This message contains <em>some</em> <b>markup</b></p>
'
);
...
@@ -1497,9 +1497,9 @@
...
@@ -1497,9 +1497,9 @@
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
message
=
'
This message contains a hyperlink: www.opkode.com
'
;
var
message
=
'
This message contains a hyperlink: www.opkode.com
'
;
spyOn
(
view
,
'
sendMessage
'
).
and
.
callThrough
();
spyOn
(
view
.
model
,
'
sendMessage
'
).
and
.
callThrough
();
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
This message contains a hyperlink: <a target="_blank" rel="noopener" href="http://www.opkode.com">www.opkode.com</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
This message contains a hyperlink: <a target="_blank" rel="noopener" href="http://www.opkode.com">www.opkode.com</a>
'
);
...
@@ -1518,10 +1518,10 @@
...
@@ -1518,10 +1518,10 @@
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
spyOn
(
view
,
'
sendMessage
'
).
and
.
callThrough
();
spyOn
(
view
.
model
,
'
sendMessage
'
).
and
.
callThrough
();
message
=
"
http://www.opkode.com/'onmouseover='alert(1)'whatever
"
;
message
=
"
http://www.opkode.com/'onmouseover='alert(1)'whatever
"
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="http://www.opkode.com/%27onmouseover=%27alert%281%29%27whatever">http://www.opkode.com/
\'
onmouseover=
\'
alert(1)
\'
whatever</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="http://www.opkode.com/%27onmouseover=%27alert%281%29%27whatever">http://www.opkode.com/
\'
onmouseover=
\'
alert(1)
\'
whatever</a>
'
);
...
@@ -1529,7 +1529,7 @@
...
@@ -1529,7 +1529,7 @@
message
=
'
http://www.opkode.com/"onmouseover="alert(1)"whatever
'
;
message
=
'
http://www.opkode.com/"onmouseover="alert(1)"whatever
'
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="http://www.opkode.com/%22onmouseover=%22alert%281%29%22whatever">http://www.opkode.com/"onmouseover="alert(1)"whatever</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="http://www.opkode.com/%22onmouseover=%22alert%281%29%22whatever">http://www.opkode.com/"onmouseover="alert(1)"whatever</a>
'
);
...
@@ -1537,7 +1537,7 @@
...
@@ -1537,7 +1537,7 @@
message
=
"
https://en.wikipedia.org/wiki/Ender's_Game
"
;
message
=
"
https://en.wikipedia.org/wiki/Ender's_Game
"
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/Ender%27s_Game">https://en.wikipedia.org/wiki/Ender
\'
s_Game</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/Ender%27s_Game">https://en.wikipedia.org/wiki/Ender
\'
s_Game</a>
'
);
...
@@ -1545,7 +1545,7 @@
...
@@ -1545,7 +1545,7 @@
message
=
"
https://en.wikipedia.org/wiki/Ender%27s_Game
"
;
message
=
"
https://en.wikipedia.org/wiki/Ender%27s_Game
"
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
text
()).
toEqual
(
message
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/Ender%27s_Game">https://en.wikipedia.org/wiki/Ender%27s_Game</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/Ender%27s_Game">https://en.wikipedia.org/wiki/Ender%27s_Game</a>
'
);
...
@@ -1564,13 +1564,13 @@
...
@@ -1564,13 +1564,13 @@
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
spyOn
(
view
,
'
sendMessage
'
).
and
.
callThrough
();
spyOn
(
view
.
model
,
'
sendMessage
'
).
and
.
callThrough
();
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
waitUntil
(
function
()
{
test_utils
.
waitUntil
(
function
()
{
return
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message img
'
).
length
;
return
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message img
'
).
length
;
},
1000
).
then
(
function
()
{
},
1000
).
then
(
function
()
{
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
html
()).
toEqual
(
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="
'
+
base_url
+
'
/logo/conversejs-filled.svg"><img class="chat-image"
'
+
'
<a target="_blank" rel="noopener" href="
'
+
base_url
+
'
/logo/conversejs-filled.svg"><img class="chat-image"
'
+
...
@@ -1581,7 +1581,7 @@
...
@@ -1581,7 +1581,7 @@
return
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message img
'
).
length
===
2
;
return
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message img
'
).
length
===
2
;
},
1000
);
},
1000
);
}).
then
(
function
()
{
}).
then
(
function
()
{
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
html
()).
toEqual
(
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="
'
+
base_url
+
'
/logo/conversejs-filled.svg?param1=val1&param2=val2"><img
'
+
'
<a target="_blank" rel="noopener" href="
'
+
base_url
+
'
/logo/conversejs-filled.svg?param1=val1&param2=val2"><img
'
+
...
@@ -1594,7 +1594,7 @@
...
@@ -1594,7 +1594,7 @@
return
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message img
'
).
length
===
4
;
return
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message img
'
).
length
===
4
;
},
1000
);
},
1000
);
}).
then
(
function
()
{
}).
then
(
function
()
{
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
html
()).
toEqual
(
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="
'
+
base_url
+
'
/logo/conversejs-filled.svg?param1=val1&param2=val2">
'
+
'
<a target="_blank" rel="noopener" href="
'
+
base_url
+
'
/logo/conversejs-filled.svg?param1=val1&param2=val2">
'
+
...
@@ -2722,13 +2722,13 @@
...
@@ -2722,13 +2722,13 @@
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
spyOn
(
view
,
'
sendMessage
'
).
and
.
callThrough
();
spyOn
(
view
.
model
,
'
sendMessage
'
).
and
.
callThrough
();
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
waitUntil
(
function
()
{
test_utils
.
waitUntil
(
function
()
{
return
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
length
;
return
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
length
;
},
1000
).
then
(
function
()
{
},
1000
).
then
(
function
()
{
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
expect
(
view
.
model
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
var
msg
=
$
(
view
.
el
).
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-msg-content
'
);
expect
(
msg
.
html
()).
toEqual
(
expect
(
msg
.
html
()).
toEqual
(
'
<a target="_blank" rel="noopener" href="https://www.openstreetmap.org/?mlat=37.786971&
'
+
'
<a target="_blank" rel="noopener" href="https://www.openstreetmap.org/?mlat=37.786971&
'
+
...
...
spec/otr.js
View file @
6cab7fcc
...
@@ -85,7 +85,7 @@
...
@@ -85,7 +85,7 @@
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
var
chatview
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
chatview
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
chatview
.
model
.
set
(
'
otr_status
'
,
UNVERIFIED
);
chatview
.
model
.
set
(
'
otr_status
'
,
UNVERIFIED
);
var
stanza
=
chatview
.
createMessageStanza
(
new
_converse
.
Message
({
message
:
'
hello world
'
}));
var
stanza
=
chatview
.
model
.
createMessageStanza
(
new
_converse
.
Message
({
message
:
'
hello world
'
}));
var
$hints
=
$
(
stanza
.
nodeTree
).
find
(
'
[xmlns="
'
+
Strophe
.
NS
.
HINTS
+
'
"]
'
);
var
$hints
=
$
(
stanza
.
nodeTree
).
find
(
'
[xmlns="
'
+
Strophe
.
NS
.
HINTS
+
'
"]
'
);
expect
(
$hints
.
length
).
toBe
(
3
);
expect
(
$hints
.
length
).
toBe
(
3
);
expect
(
$hints
.
get
(
0
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$hints
.
get
(
0
).
tagName
).
toBe
(
'
no-store
'
);
...
@@ -111,7 +111,7 @@
...
@@ -111,7 +111,7 @@
var
chatbox
=
_converse
.
chatboxes
.
get
(
sender_jid
);
var
chatbox
=
_converse
.
chatboxes
.
get
(
sender_jid
);
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
chatbox
.
set
(
'
otr_status
'
,
1
);
// Set OTR status to UNVERIFIED, to mock an encrypted session
chatbox
.
set
(
'
otr_status
'
,
1
);
// Set OTR status to UNVERIFIED, to mock an encrypted session
chatbox
.
trigger
(
'
sendMessage
'
,
new
_converse
.
Message
({
message
:
msgtext
}));
chatbox
.
sendMessage
(
new
_converse
.
Message
({
'
message
'
:
msgtext
}));
var
$sent
=
$
(
_converse
.
connection
.
send
.
calls
.
argsFor
(
0
)[
0
].
tree
());
var
$sent
=
$
(
_converse
.
connection
.
send
.
calls
.
argsFor
(
0
)[
0
].
tree
());
expect
(
$sent
.
find
(
'
body
'
).
siblings
(
'
private
'
).
length
).
toBe
(
1
);
expect
(
$sent
.
find
(
'
body
'
).
siblings
(
'
private
'
).
length
).
toBe
(
1
);
expect
(
$sent
.
find
(
'
private
'
).
length
).
toBe
(
1
);
expect
(
$sent
.
find
(
'
private
'
).
length
).
toBe
(
1
);
...
...
src/converse-chatview.js
View file @
6cab7fcc
...
@@ -623,7 +623,6 @@
...
@@ -623,7 +623,6 @@
username
=
attrs
.
sender
===
'
me
'
&&
__
(
'
me
'
)
||
fullname
;
username
=
attrs
.
sender
===
'
me
'
&&
__
(
'
me
'
)
||
fullname
;
template
=
attrs
.
is_spoiler
?
tpl_spoiler_message
:
tpl_message
;
template
=
attrs
.
is_spoiler
?
tpl_spoiler_message
:
tpl_message
;
}
}
text
=
u
.
geoUriToHttp
(
text
,
_converse
);
text
=
u
.
geoUriToHttp
(
text
,
_converse
);
const
msg_time
=
moment
(
attrs
.
time
)
||
moment
;
const
msg_time
=
moment
(
attrs
.
time
)
||
moment
;
...
...
src/converse-otr.js
View file @
6cab7fcc
...
@@ -71,6 +71,18 @@
...
@@ -71,6 +71,18 @@
}
}
},
},
createMessageStanza
()
{
const
stanza
=
this
.
__super__
.
createMessageStanza
.
apply
(
this
,
arguments
);
if
(
this
.
get
(
'
otr_status
'
)
!==
UNENCRYPTED
||
utils
.
isOTRMessage
(
stanza
.
nodeTree
))
{
// OTR messages aren't carbon copied
stanza
.
c
(
'
private
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
CARBONS
}).
up
()
.
c
(
'
no-store
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
}).
up
()
.
c
(
'
no-permanent-store
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
}).
up
()
.
c
(
'
no-copy
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
});
}
return
stanza
;
},
shouldPlayNotification
(
$message
)
{
shouldPlayNotification
(
$message
)
{
/* Don't play a notification if this is an OTR message but
/* Don't play a notification if this is an OTR message but
* encryption is not yet set up. That would mean that the
* encryption is not yet set up. That would mean that the
...
@@ -271,18 +283,6 @@
...
@@ -271,18 +283,6 @@
}
}
},
},
createMessageStanza
()
{
const
stanza
=
this
.
__super__
.
createMessageStanza
.
apply
(
this
,
arguments
);
if
(
this
.
model
.
get
(
'
otr_status
'
)
!==
UNENCRYPTED
||
utils
.
isOTRMessage
(
stanza
.
nodeTree
))
{
// OTR messages aren't carbon copied
stanza
.
c
(
'
private
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
CARBONS
}).
up
()
.
c
(
'
no-store
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
}).
up
()
.
c
(
'
no-permanent-store
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
}).
up
()
.
c
(
'
no-copy
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
});
}
return
stanza
;
},
parseMessageForCommands
(
text
)
{
parseMessageForCommands
(
text
)
{
const
{
_converse
}
=
this
.
__super__
;
const
{
_converse
}
=
this
.
__super__
;
const
match
=
text
.
replace
(
/^
\s
*/
,
""
).
match
(
/^
\/(
.*
)\s
*$/
);
const
match
=
text
.
replace
(
/^
\s
*/
,
""
).
match
(
/^
\/(
.*
)\s
*$/
);
...
...
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