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
d1d81bf9
Commit
d1d81bf9
authored
May 21, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Remove condition before fetching members
parent
bb0c0fcd
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
318 additions
and
22 deletions
+318
-22
spec/muc.js
spec/muc.js
+16
-15
src/headless/converse-bookmarks.js
src/headless/converse-bookmarks.js
+293
-0
src/headless/converse-muc.js
src/headless/converse-muc.js
+9
-7
No files found.
spec/muc.js
View file @
d1d81bf9
...
...
@@ -145,10 +145,8 @@
chatroomview
.
close
();
_converse
.
muc_instant_rooms
=
false
;
var
sendIQ
=
_converse
.
connection
.
sendIQ
;
const
sendIQ
=
_converse
.
connection
.
sendIQ
;
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
sent_IQ
=
iq
;
sent_IQ_els
.
push
(
iq
.
nodeTree
);
IQ_id
=
sendIQ
.
bind
(
this
)(
iq
,
callback
,
errback
);
});
// Test with configuration
...
...
@@ -199,15 +197,18 @@
.
c
(
'
status
'
,
{
code
:
'
201
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
_converse
.
connection
.
sendIQ
).
toHaveBeenCalled
();
expect
(
sent_IQ
.
toLocaleString
()).
toBe
(
`<iq id="
${
IQ_id
}
" to="room@conference.example.org" type="get" xmlns="jabber:client">`
+
`<query xmlns="http://jabber.org/protocol/muc#owner"/></iq>`
);
const
IQ_stanzas
=
_converse
.
connection
.
IQ_stanzas
;
const
iq
=
IQ_stanzas
.
filter
(
s
=>
s
.
querySelector
(
`query[xmlns="
${
Strophe
.
NS
.
MUC_OWNER
}
"]`
)).
pop
();
expect
(
Strophe
.
serialize
(
iq
)).
toBe
(
`<iq id="
${
iq
.
getAttribute
(
'
id
'
)}
" to="room@conference.example.org" type="get" xmlns="jabber:client">`
+
`<query xmlns="http://jabber.org/protocol/muc#owner"/></iq>`
);
const
node
=
u
.
toStanza
(
`
<iq xmlns="jabber:client"
type="result"
to="dummy@localhost/pda"
from="room@conference.example.org" id="
${
IQ_id
}
">
from="room@conference.example.org" id="
${
iq
.
getAttribute
(
'
id
'
)
}
">
<query xmlns="http://jabber.org/protocol/muc#owner">
<x xmlns="jabber:x:data" type="form">
<title>Configuration for room@conference.example.org</title>
...
...
@@ -244,10 +245,8 @@
spyOn
(
chatroomview
.
model
,
'
sendConfiguration
'
).
and
.
callThrough
();
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
node
));
await
test_utils
.
waitUntil
(()
=>
chatroomview
.
model
.
sendConfiguration
.
calls
.
count
()
===
1
);
var
sent_stanza
=
sent_IQ_els
.
pop
();
while
(
sent_stanza
.
getAttribute
(
'
type
'
)
!==
'
set
'
)
{
sent_stanza
=
sent_IQ_els
.
pop
();
}
const
sent_stanza
=
IQ_stanzas
.
filter
(
s
=>
s
.
getAttribute
(
'
type
'
)
===
'
set
'
).
pop
();
expect
(
sizzle
(
'
field[var="muc#roomconfig_roomname"] value
'
,
sent_stanza
).
pop
().
textContent
).
toBe
(
'
Room
'
);
expect
(
sizzle
(
'
field[var="muc#roomconfig_roomdesc"] value
'
,
sent_stanza
).
pop
().
textContent
).
toBe
(
'
Welcome to this groupchat
'
);
expect
(
sizzle
(
'
field[var="muc#roomconfig_persistentroom"] value
'
,
sent_stanza
).
pop
().
textContent
).
toBe
(
'
1
'
);
...
...
@@ -372,17 +371,19 @@
.
c
(
'
status
'
).
attrs
({
code
:
'
201
'
}).
nodeTree
;
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
var
info_text
=
view
.
el
.
querySelector
(
'
.chat-content .chat-info
'
).
textContent
;
const
info_text
=
view
.
el
.
querySelector
(
'
.chat-content .chat-info
'
).
textContent
;
expect
(
info_text
).
toBe
(
'
A new groupchat has been created
'
);
// An instant room is created by saving the default configuratoin.
//
/* <iq to="myroom@conference.chat.example.org" type="set" xmlns="jabber:client" id="5025e055-036c-4bc5-a227-706e7e352053:sendIQ">
* <query xmlns="http://jabber.org/protocol/muc#owner"><x xmlns="jabber:x:data" type="submit"/></query>
* </iq>
*/
expect
(
sent_IQ
.
toLocaleString
()).
toBe
(
`<iq id="
${
IQ_id
}
" to="lounge@localhost" type="set" xmlns="jabber:client">`
+
const
iq
=
IQ_stanzas
.
filter
(
s
=>
s
.
querySelector
(
`query[xmlns="
${
Strophe
.
NS
.
MUC_OWNER
}
"]`
)).
pop
();
expect
(
Strophe
.
serialize
(
iq
)).
toBe
(
`<iq id="
${
iq
.
getAttribute
(
'
id
'
)}
" to="lounge@localhost" type="set" xmlns="jabber:client">`
+
`<query xmlns="http://jabber.org/protocol/muc#owner"><x type="submit" xmlns="jabber:x:data"/>`
+
`</query></iq>`
);
done
();
...
...
src/headless/converse-bookmarks.js
0 → 100644
View file @
d1d81bf9
This diff is collapsed.
Click to expand it.
src/headless/converse-muc.js
View file @
d1d81bf9
...
...
@@ -221,13 +221,15 @@ converse.plugins.add('converse-muc', {
},
async
onConnectionStatusChanged
()
{
if
(
this
.
get
(
'
connection_status
'
)
===
converse
.
ROOMSTATUS
.
ENTERED
&&
_converse
.
auto_register_muc_nickname
&&
!
this
.
get
(
'
reserved_nick
'
)
&&
await
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
MUC_REGISTER
,
this
.
get
(
'
jid
'
)))
{
if
(
this
.
get
(
'
connection_status
'
)
===
converse
.
ROOMSTATUS
.
ENTERED
)
{
this
.
occupants
.
fetchMembers
();
this
.
registerNickname
()
if
(
_converse
.
auto_register_muc_nickname
&&
!
this
.
get
(
'
reserved_nick
'
)
&&
await
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
MUC_REGISTER
,
this
.
get
(
'
jid
'
)))
{
this
.
registerNickname
()
}
}
},
...
...
@@ -664,7 +666,7 @@ converse.plugins.add('converse-muc', {
* Given a <field> element, return a copy with a <value> child if
* we can find a value for it in this rooms config.
* @private
* @method _converse.ChatRoom#a
utoConfigureChatRoom
* @method _converse.ChatRoom#a
ddFieldValue
* @returns { Element }
*/
addFieldValue
(
field
)
{
...
...
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