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
067d87a7
Commit
067d87a7
authored
Nov 14, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing test
parent
7cb889b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
14 deletions
+34
-14
dist/converse.js
dist/converse.js
+5
-3
spec/messages.js
spec/messages.js
+24
-8
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+5
-3
No files found.
dist/converse.js
View file @
067d87a7
...
...
@@ -71399,14 +71399,16 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
const id = message.getAttribute('id');
if (id) {
const msg
= chatbox.messages.findW
here({
const msg
s = chatbox.messages.w
here({
'msgid': id
});
if (!msg) {
//
This
error refers to a message not included in our store.
if (!msg
s.length || msgs.filter(m => m.get('type') === 'error').length
) {
//
If the
error refers to a message not included in our store.
// We assume that this was a CSI message (which we don't store).
// See https://github.com/conversejs/converse.js/issues/1317
//
// We also ignore duplicate error messages.
return;
}
} else {
spec/messages.js
View file @
067d87a7
...
...
@@ -1564,8 +1564,8 @@
*/
let
stanza
=
$msg
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
error
'
,
'
id
'
:
'
82bc02ce-9651-4336-baf0-fa04762ed8d2
'
,
'
type
'
:
'
error
'
,
'
id
'
:
'
82bc02ce-9651-4336-baf0-fa04762ed8d2
'
,
'
from
'
:
sender_jid
})
.
c
(
'
error
'
,
{
'
type
'
:
'
cancel
'
})
...
...
@@ -1577,8 +1577,8 @@
expect
(
chat_content
.
querySelector
(
'
.chat-error
'
).
textContent
).
toEqual
(
error_txt
);
stanza
=
$msg
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
error
'
,
'
id
'
:
'
some-other-unused-id
'
,
'
type
'
:
'
error
'
,
'
id
'
:
'
6fcdeee3-000f-4ce8-a17e-9ce28f0ae104
'
,
'
from
'
:
sender_jid
})
.
c
(
'
error
'
,
{
'
type
'
:
'
cancel
'
})
...
...
@@ -1589,12 +1589,11 @@
await
test_utils
.
waitUntil
(()
=>
view
.
model
.
messages
.
length
>
1
);
expect
(
chat_content
.
querySelectorAll
(
'
.chat-error
'
).
length
).
toEqual
(
2
);
// If the last message is already an error message,
// then we don't render it another time.
// We don't render duplicates
stanza
=
$msg
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
error
'
,
'
id
'
:
'
another-unused-id
'
,
'
id
'
:
'
6fcdeee3-000f-4ce8-a17e-9ce28f0ae104
'
,
'
from
'
:
sender_jid
})
.
c
(
'
error
'
,
{
'
type
'
:
'
cancel
'
})
...
...
@@ -1604,11 +1603,28 @@
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
await
test_utils
.
waitUntil
(()
=>
view
.
model
.
messages
.
length
>
2
);
expect
(
chat_content
.
querySelectorAll
(
'
.chat-error
'
).
length
).
toEqual
(
2
);
// We send another message, for which an error will
// not be received, to test that errors appear
// after the relevant message.
msg_text
=
'
This message will be sent, and also receive an error
'
;
message
=
view
.
model
.
messages
.
create
({
'
msgid
'
:
'
another-id
'
,
'
fullname
'
:
fullname
,
'
sender
'
:
'
me
'
,
'
time
'
:
moment
().
format
(),
'
message
'
:
msg_text
});
view
.
model
.
sendMessage
(
message
);
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
msg_txt
=
sizzle
(
'
.chat-msg:last .chat-msg__text
'
,
chat_content
).
pop
().
textContent
;
expect
(
msg_txt
).
toEqual
(
msg_text
);
// A different error message will however render
stanza
=
$msg
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
error
'
,
'
id
'
:
'
another-id
'
,
'
id
'
:
'
another-id
'
,
'
from
'
:
sender_jid
})
.
c
(
'
error
'
,
{
'
type
'
:
'
cancel
'
})
...
...
src/headless/converse-chatboxes.js
View file @
067d87a7
...
...
@@ -671,11 +671,13 @@ converse.plugins.add('converse-chatboxes', {
}
const
id
=
message
.
getAttribute
(
'
id
'
);
if
(
id
)
{
const
msg
=
chatbox
.
messages
.
findW
here
({
'
msgid
'
:
id
});
if
(
!
msg
)
{
//
This
error refers to a message not included in our store.
const
msg
s
=
chatbox
.
messages
.
w
here
({
'
msgid
'
:
id
});
if
(
!
msg
s
.
length
||
msgs
.
filter
(
m
=>
m
.
get
(
'
type
'
)
===
'
error
'
).
length
)
{
//
If the
error refers to a message not included in our store.
// We assume that this was a CSI message (which we don't store).
// See https://github.com/conversejs/converse.js/issues/1317
//
// We also ignore duplicate error messages.
return
;
}
}
else
{
...
...
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