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
f2f05ff4
Commit
f2f05ff4
authored
Feb 28, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MUC: Don't show duplicate `join` messages.
parent
21fbb7b7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
10 deletions
+34
-10
converse-logs/converse-logs.js
converse-logs/converse-logs.js
+1
-1
spec/chatroom.js
spec/chatroom.js
+17
-4
spec/transcripts.js
spec/transcripts.js
+3
-3
src/converse-muc.js
src/converse-muc.js
+13
-2
No files found.
converse-logs/converse-logs.js
View file @
f2f05ff4
define
(
"
transcripts
"
,
[
"
tpl!converse-logs/
conversejs.containers-1460718487729
"
,
"
tpl!converse-logs/
double_logins
"
,
],
function
()
{
return
arguments
;
});
spec/chatroom.js
View file @
f2f05ff4
...
...
@@ -400,7 +400,7 @@
}).
up
()
.
c
(
'
status
'
,
{
code
:
'
110
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
$chat_content
.
find
(
'
div.chat-info:first
'
).
html
()).
toBe
(
"
some1 has joined the room
"
);
expect
(
$chat_content
.
find
(
'
div.chat-info:first
'
).
html
()).
toBe
(
"
some1 has joined the room
.
"
);
presence
=
$pres
({
to
:
'
dummy@localhost/_converse.js-29092160
'
,
...
...
@@ -413,7 +413,20 @@
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
2
);
expect
(
$chat_content
.
find
(
'
div.chat-info:last
'
).
html
()).
toBe
(
"
newguy has joined the room
"
);
expect
(
$chat_content
.
find
(
'
div.chat-info:last
'
).
html
()).
toBe
(
"
newguy has joined the room.
"
);
// Don't show duplicate join messages
presence
=
$pres
({
to
:
'
dummy@localhost/_converse.js-290918392
'
,
from
:
'
coven@chat.shakespeare.lit/newguy
'
}).
c
(
'
x
'
,
{
xmlns
:
Strophe
.
NS
.
MUC_USER
})
.
c
(
'
item
'
,
{
'
affiliation
'
:
'
none
'
,
'
jid
'
:
'
newguy@localhost/_converse.js-290929789
'
,
'
role
'
:
'
participant
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
2
);
presence
=
$pres
({
to
:
'
dummy@localhost/_converse.js-29092160
'
,
...
...
@@ -1203,7 +1216,7 @@
expect
(
$occupants
.
children
().
first
(
0
).
text
()).
toBe
(
"
oldnick
"
);
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
2
);
expect
(
$chat_content
.
find
(
'
div.chat-info:first
'
).
html
()).
toBe
(
"
oldnick has joined the room
"
);
expect
(
$chat_content
.
find
(
'
div.chat-info:first
'
).
html
()).
toBe
(
"
oldnick has joined the room
.
"
);
expect
(
$chat_content
.
find
(
'
div.chat-info:last
'
).
html
()).
toBe
(
__
(
_converse
.
muc
.
new_nickname_messages
[
"
210
"
],
"
oldnick
"
));
presence
=
$pres
().
attrs
({
...
...
@@ -1245,7 +1258,7 @@
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
4
);
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
get
(
2
).
textContent
).
toBe
(
__
(
_converse
.
muc
.
new_nickname_messages
[
"
303
"
],
"
newnick
"
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
last
().
html
()).
toBe
(
"
newnick has joined the room
"
);
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
last
().
html
()).
toBe
(
"
newnick has joined the room
.
"
);
$occupants
=
view
.
$
(
'
.occupant-list
'
);
expect
(
$occupants
.
children
().
length
).
toBe
(
1
);
expect
(
$occupants
.
children
().
first
(
0
).
text
()).
toBe
(
"
newnick
"
);
...
...
spec/transcripts.js
View file @
f2f05ff4
...
...
@@ -50,10 +50,10 @@
it
(
"
can be used to replay conversations
"
,
mock
.
initConverse
(
function
(
_converse
)
{
/*
test_utils.openChatRoom(_converse, "dummy", 'rooms.localhost', 'jc');
test_utils.openChatRoom(_converse, "prosody", 'conference.prosody.im', 'jc');
test_utils.open
AndEnter
ChatRoom(_converse, "dummy", 'rooms.localhost', 'jc');
test_utils.open
AndEnter
ChatRoom(_converse, "prosody", 'conference.prosody.im', 'jc');
*/
test_utils
.
open
ChatRoom
(
_converse
,
"
discuss
"
,
'
conference.conversejs.org
'
,
'
ee
'
);
test_utils
.
open
AndEnterChatRoom
(
_converse
,
"
discuss
"
,
'
conference.conversejs.org
'
,
'
jc
'
);
spyOn
(
_converse
,
'
areDesktopNotificationsEnabled
'
).
andReturn
(
true
);
_
.
each
(
transcripts
,
function
(
transcript
)
{
var
text
=
transcript
();
...
...
src/converse-muc.js
View file @
f2f05ff4
...
...
@@ -1702,15 +1702,24 @@
// result look like the structure returned by
// parseXUserElement. Not nice...
var
nick
=
Strophe
.
getResourceFromJid
(
stanza
.
getAttribute
(
'
from
'
));
if
(
stanza
.
getAttribute
(
'
type
'
)
===
'
unavailable
'
)
{
var
stat
=
stanza
.
querySelector
(
'
status
'
);
if
(
stanza
.
getAttribute
(
'
type
'
)
===
'
unavailable
'
)
{
if
(
!
_
.
isNull
(
stat
)
&&
stat
.
textContent
)
{
return
[{
'
messages
'
:
[
__
(
nick
+
'
has left the room. "
'
+
stat
.
textContent
+
'
"
'
)]}];
}
else
{
return
[{
'
messages
'
:
[
__
(
nick
+
'
has left the room
'
)]}];
}
}
return
[{
'
messages
'
:
[
__
(
nick
+
'
has joined the room
'
)]}];
if
(
!
this
.
occupantsview
.
model
.
find
({
'
nick
'
:
nick
}))
{
// Only show join message if we don't already have the
// occupant model. Doing so avoids showing duplicate
// join messages.
if
(
!
_
.
isNull
(
stat
)
&&
stat
.
textContent
)
{
return
[{
'
messages
'
:
[
__
(
nick
+
'
has joined the room. "
'
+
stat
.
textContent
+
'
"
'
)]}];
}
else
{
return
[{
'
messages
'
:
[
__
(
nick
+
'
has joined the room.
'
)]}];
}
}
},
showStatusMessages
:
function
(
stanza
)
{
...
...
@@ -1837,6 +1846,8 @@
this
.
getRoomFeatures
();
}
this
.
hideSpinner
().
showStatusMessages
(
pres
);
// This must be called after showStatusMessages so that
// "join" messages are correctly shown.
this
.
occupantsview
.
updateOccupantsOnPresence
(
pres
);
if
(
this
.
model
.
get
(
'
role
'
)
!==
'
none
'
&&
this
.
model
.
get
(
'
connection_status
'
)
===
ROOMSTATUS
.
CONNECTING
)
{
...
...
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