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
99f539b3
Commit
99f539b3
authored
Nov 15, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MUC: Don't show duplicate subsequent `info` messages
parent
3d4bad4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
spec/muc_messages.js
spec/muc_messages.js
+26
-0
src/headless/converse-muc.js
src/headless/converse-muc.js
+8
-0
No files found.
spec/muc_messages.js
View file @
99f539b3
...
...
@@ -39,6 +39,32 @@
expect
(
u
.
hasClass
(
'
chat-msg--followup
'
,
messages
[
1
])).
toBe
(
false
);
done
();
}));
it
(
"
is not shown if its a duplicate
"
,
mock
.
initConverse
(
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
async
function
(
done
,
_converse
)
{
const
muc_jid
=
'
lounge@montague.lit
'
;
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
muc_jid
,
'
romeo
'
);
const
view
=
_converse
.
api
.
chatviews
.
get
(
muc_jid
);
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelectorAll
(
'
.chat-info
'
).
length
);
const
presence
=
u
.
toStanza
(
`
<presence xmlns="jabber:client" to="
${
_converse
.
jid
}
" from="
${
muc_jid
}
/romeo">
<x xmlns="http://jabber.org/protocol/muc#user">
<status code="201"/>
<item role="moderator" affiliation="owner" jid="
${
_converse
.
jid
}
"/>
<status code="110"/>
</x>
</presence>
`
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelectorAll
(
'
.chat-info
'
).
length
>
1
);
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-info
'
).
length
).
toBe
(
2
);
done
();
}));
});
...
...
src/headless/converse-muc.js
View file @
99f539b3
...
...
@@ -1791,6 +1791,14 @@ converse.plugins.add('converse-muc', {
message
=
__
(
_converse
.
muc
.
new_nickname_messages
[
code
],
nick
);
}
if
(
message
)
{
if
(
code
===
"
201
"
&&
this
.
messages
.
findWhere
({
'
type
'
:
'
info
'
,
message
}))
{
return
;
}
else
if
(
code
in
_converse
.
muc
.
info_messages
&&
this
.
messages
.
length
&&
this
.
messages
.
pop
().
get
(
'
message
'
)
===
message
)
{
// XXX: very naive duplication checking
return
;
}
this
.
messages
.
create
({
'
type
'
:
'
info
'
,
message
});
}
});
...
...
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