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
6a851b5d
Commit
6a851b5d
authored
Jan 15, 2018
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
ddc570d4
8c616f0e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
29 deletions
+47
-29
spec/chatbox.js
spec/chatbox.js
+43
-16
src/converse-chatview.js
src/converse-chatview.js
+3
-3
src/converse-mam.js
src/converse-mam.js
+1
-10
No files found.
spec/chatbox.js
View file @
6a851b5d
...
...
@@ -20,6 +20,29 @@
return
describe
(
"
Chatboxes
"
,
function
()
{
describe
(
"
A Chatbox
"
,
function
()
{
it
(
"
has a /help command to show the available commands
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
openControlBox
();
test_utils
.
openContactsPanel
(
_converse
);
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
test_utils
.
sendMessage
(
view
,
'
/help
'
);
const
info_messages
=
Array
.
prototype
.
slice
.
call
(
view
.
el
.
querySelectorAll
(
'
.chat-info:not(.chat-date)
'
),
0
);
expect
(
info_messages
.
length
).
toBe
(
3
);
expect
(
info_messages
.
pop
().
textContent
).
toBe
(
'
/help: Show this menu
'
);
expect
(
info_messages
.
pop
().
textContent
).
toBe
(
'
/me: Write in the third person
'
);
expect
(
info_messages
.
pop
().
textContent
).
toBe
(
'
/clear: Remove messages
'
);
done
();
}));
it
(
"
supports the /me command
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
...
...
@@ -938,6 +961,7 @@
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
openControlBox
();
test_utils
.
openContactsPanel
(
_converse
);
...
...
@@ -978,7 +1002,7 @@
msg
=
$msg
({
'
id
'
:
'
aeb214
'
,
'
to
'
:
_converse
.
bare_jid
})
.
c
(
'
forwarded
'
,
{
'
xmlns
'
:
'
urn:xmpp:forward:0
'
})
.
c
(
'
delay
'
,
{
'
xmlns
'
:
'
urn:xmpp:delay
'
,
'
stamp
'
:
'
2017-12-31T2
3
:08:25Z
'
}).
up
()
.
c
(
'
delay
'
,
{
'
xmlns
'
:
'
urn:xmpp:delay
'
,
'
stamp
'
:
'
2017-12-31T2
2
:08:25Z
'
}).
up
()
.
c
(
'
message
'
,
{
'
xmlns
'
:
'
jabber:client
'
,
'
to
'
:
_converse
.
bare_jid
,
...
...
@@ -1026,7 +1050,7 @@
msg
=
$msg
({
'
id
'
:
'
aeb218
'
,
'
to
'
:
_converse
.
bare_jid
})
.
c
(
'
forwarded
'
,
{
'
xmlns
'
:
'
urn:xmpp:forward:0
'
})
.
c
(
'
delay
'
,
{
'
xmlns
'
:
'
urn:xmpp:delay
'
,
'
stamp
'
:
'
2018-01-02T2
3
:28:23Z
'
}).
up
()
.
c
(
'
delay
'
,
{
'
xmlns
'
:
'
urn:xmpp:delay
'
,
'
stamp
'
:
'
2018-01-02T2
2
:28:23Z
'
}).
up
()
.
c
(
'
message
'
,
{
'
xmlns
'
:
'
jabber:client
'
,
'
to
'
:
_converse
.
bare_jid
,
...
...
@@ -1067,14 +1091,16 @@
var
$time
=
$chat_content
.
find
(
'
time
'
);
expect
(
$time
.
length
).
toEqual
(
4
);
$time
=
$chat_content
.
find
(
'
time:first
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
'
2017-12-31T00:00:00+00:00
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
(
'
2017-12-31T00:00:00
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
'
Sunday Dec 31st 2017
'
)
expect
(
$time
[
0
].
nextElementSibling
.
querySelector
(
'
.chat-msg-content
'
).
textContent
).
toBe
(
'
Older message
'
);
var
$el
=
$chat_content
.
find
(
'
.chat-message:first
'
).
find
(
'
.chat-msg-content
'
)
expect
(
$el
.
text
()).
toEqual
(
'
Older message
'
);
$time
=
$chat_content
.
find
(
'
time:eq(1)
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
'
2018-01-01T00:00:00+00:00
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
(
'
2018-01-01T00:00:00
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
"
Monday Jan 1st 2018
"
);
expect
(
$time
[
0
].
nextElementSibling
.
querySelector
(
'
.chat-msg-content
'
).
textContent
).
toBe
(
'
Inbetween message
'
);
$el
=
$chat_content
.
find
(
'
.chat-message:eq(1)
'
);
expect
(
$el
.
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
'
Inbetween message
'
);
...
...
@@ -1083,7 +1109,8 @@
expect
(
$el
.
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
'
another inbetween message
'
);
$time
=
$chat_content
.
find
(
'
time:nth(2)
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
'
2018-01-02T00:00:00+00:00
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
(
'
2018-01-02T00:00:00
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
"
Tuesday Jan 2nd 2018
"
);
expect
(
$time
[
0
].
nextElementSibling
.
querySelector
(
'
.chat-msg-content
'
).
textContent
).
toBe
(
'
An earlier message on the next day
'
);
$el
=
$chat_content
.
find
(
'
.chat-message:eq(3)
'
);
expect
(
$el
.
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
'
An earlier message on the next day
'
);
...
...
src/converse-chatview.js
View file @
6a851b5d
...
...
@@ -738,9 +738,9 @@
}
else
if
(
match
[
1
]
===
"
help
"
)
{
const
msgs
=
[
`<strong>/
help</strong>:
${
__
(
'
Show this menu
'
)}
`
,
`<strong>/me</strong>:
${
__
(
'
Write in the third person
'
)}
`
,
`<strong>/
clear</strong>:
${
__
(
'
Remove messages
'
)}
`
`<strong>/
clear</strong>:
${
__
(
'
Remove messages
'
)}
`
,
`<strong>/me</strong>:
${
__
(
'
Write in the third person
'
)}
`
,
`<strong>/
help</strong>:
${
__
(
'
Show this menu
'
)}
`
];
this
.
showHelpMessages
(
msgs
);
return
;
...
...
src/converse-mam.js
View file @
6a851b5d
...
...
@@ -73,7 +73,6 @@
*/
if
(
this
.
disable_mam
)
{
return
;
}
const
{
_converse
}
=
this
.
__super__
;
this
.
addSpinner
(
true
);
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
MAM
,
_converse
.
bare_jid
).
then
(
(
result
)
=>
{
// Success
if
(
result
.
supported
)
{
...
...
@@ -92,12 +91,9 @@
});
}
}
}
else
{
this
.
clearSpinner
();
}
},
()
=>
{
// Error
this
.
clearSpinner
();
_converse
.
log
(
"
Error or timeout while checking for MAM support
"
,
Strophe
.
LogLevel
.
ERROR
...
...
@@ -115,19 +111,14 @@
return
;
}
const
{
_converse
}
=
this
.
__super__
;
this
.
addSpinner
();
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
MAM
,
_converse
.
bare_jid
).
then
(
(
result
)
=>
{
// Success
if
(
result
.
supported
)
{
this
.
fetchArchivedMessages
();
}
else
{
this
.
clearSpinner
();
}
this
.
model
.
save
({
'
mam_initialized
'
:
true
});
},
()
=>
{
// Error
this
.
clearSpinner
();
_converse
.
log
(
"
Error or timeout while checking for MAM support
"
,
Strophe
.
LogLevel
.
ERROR
...
...
@@ -253,9 +244,9 @@
* Then, upon receiving them, call onChatRoomMessage
* so that they are displayed inside it.
*/
this
.
addSpinner
();
const
that
=
this
;
const
{
_converse
}
=
this
.
__super__
;
this
.
addSpinner
();
_converse
.
api
.
archive
.
query
(
_
.
extend
({
'
groupchat
'
:
true
,
...
...
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