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
cd05b897
Commit
cd05b897
authored
Sep 13, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests due to MUC disco refactoring
parent
603708a9
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
93 deletions
+124
-93
spec/chatroom.js
spec/chatroom.js
+88
-62
spec/push.js
spec/push.js
+1
-1
spec/roomslist.js
spec/roomslist.js
+10
-3
src/converse-muc-views.js
src/converse-muc-views.js
+11
-9
tests/utils.js
tests/utils.js
+14
-18
No files found.
spec/chatroom.js
View file @
cd05b897
This diff is collapsed.
Click to expand it.
spec/push.js
View file @
cd05b897
...
...
@@ -57,7 +57,7 @@
}).
then
(
done
).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}));
it
(
"
can enabled for a MUC domain
"
,
it
(
"
can
be
enabled for a MUC domain
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{
'
push_app_servers
'
:
[{
...
...
spec/roomslist.js
View file @
cd05b897
...
...
@@ -98,11 +98,18 @@
},
function
(
done
,
_converse
)
{
let
view
;
const
IQ_stanzas
=
_converse
.
connection
.
IQ_stanzas
;
const
room_jid
=
'
coven@chat.shakespeare.lit
'
;
test_utils
.
openControlBox
();
_converse
.
api
.
rooms
.
open
(
'
coven@chat.shakespeare.lit
'
,
{
'
nick
'
:
'
some1
'
})
_converse
.
api
.
rooms
.
open
(
room_jid
,
{
'
nick
'
:
'
some1
'
})
.
then
(()
=>
{
view
=
_converse
.
chatboxviews
.
get
(
'
coven@chat.shakespeare.lit
'
);
const
last_stanza
=
_
.
last
(
_converse
.
connection
.
IQ_stanzas
).
nodeTree
;
return
test_utils
.
waitUntil
(()
=>
_
.
get
(
_
.
filter
(
IQ_stanzas
,
iq
=>
iq
.
nodeTree
.
querySelector
(
`iq[to="
${
room_jid
}
"] query[xmlns="http://jabber.org/protocol/disco#info"]`
)).
pop
(),
'
nodeTree
'
));
}).
then
(
last_stanza
=>
{
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
const
IQ_id
=
last_stanza
.
getAttribute
(
'
id
'
);
const
features_stanza
=
$iq
({
'
from
'
:
'
coven@chat.shakespeare.lit
'
,
...
...
src/converse-muc-views.js
View file @
cd05b897
...
...
@@ -957,15 +957,17 @@
break
;
}
const
occupant
=
this
.
model
.
occupants
.
findWhere
({
'
nick
'
:
args
[
0
]})
||
this
.
model
.
occupants
.
findWhere
({
'
jid
'
:
args
[
0
]});
this
.
model
.
setAffiliation
(
'
member
'
,
[{
'
jid
'
:
occupant
.
get
(
'
jid
'
),
'
nick
'
:
occupant
.
get
(
'
nick
'
),
'
reason
'
:
args
[
1
]
}]).
then
(
()
=>
this
.
model
.
occupants
.
fetchMembers
(),
(
err
)
=>
this
.
onCommandError
(
err
)
);
this
.
model
.
occupants
.
findWhere
({
'
jid
'
:
args
[
0
]}),
attrs
=
{
'
jid
'
:
occupant
.
get
(
'
jid
'
),
'
reason
'
:
args
[
1
]
};
if
(
_converse
.
auto_register_muc_nickname
)
{
attrs
[
'
nick
'
]
=
occupant
.
get
(
'
nick
'
);
}
this
.
model
.
setAffiliation
(
'
member
'
,
[
attrs
])
.
then
(()
=>
this
.
model
.
occupants
.
fetchMembers
())
.
catch
(
err
=>
this
.
onCommandError
(
err
));
break
;
}
case
'
nick
'
:
if
(
!
this
.
verifyRoles
([
'
visitor
'
,
'
participant
'
,
'
moderator
'
]))
{
...
...
tests/utils.js
View file @
cd05b897
...
...
@@ -19,20 +19,17 @@
if
(
_
.
isNil
(
type
))
{
type
=
'
info
'
;
}
var
IQ_disco
,
stanza
;
return
utils
.
waitUntil
(
function
()
{
IQ_disco
=
_
.
filter
(
_converse
.
connection
.
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
'
query[xmlns="http://jabber.org/protocol/disco#
'
+
type
+
'
"]
'
)
&&
iq
.
nodeTree
.
getAttribute
(
'
to
'
)
===
entity_jid
;
}).
pop
();
return
!
_
.
isUndefined
(
IQ_disco
);
},
300
).
then
(
function
()
{
var
info_IQ_id
=
IQ_disco
.
nodeTree
.
getAttribute
(
'
id
'
);
var
stanza
=
$iq
({
return
utils
.
waitUntil
(()
=>
{
return
_
.
filter
(
_converse
.
connection
.
IQ_stanzas
,
(
iq
)
=>
sizzle
(
`iq[to="
${
entity_jid
}
"] query[xmlns="http://jabber.org/protocol/disco#
${
type
}
"]`
,
iq
.
nodeTree
).
length
).
pop
();
},
300
).
then
(
iq
=>
{
const
stanza
=
$iq
({
'
type
'
:
'
result
'
,
'
from
'
:
entity_jid
,
'
to
'
:
'
dummy@localhost/resource
'
,
'
id
'
:
i
nfo_IQ_id
'
id
'
:
i
q
.
nodeTree
.
getAttribute
(
'
id
'
),
}).
c
(
'
query
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/disco#
'
+
type
});
_
.
forEach
(
identities
,
function
(
identity
)
{
...
...
@@ -169,18 +166,17 @@
_converse
.
connection
.
_dataRecv
(
utils
.
createRequest
(
features_stanza
));
});
}
return
utils
.
waitUntil
(()
=>
_
.
get
(
_
.
filter
(
return
utils
.
waitUntil
(()
=>
_
.
filter
(
stanzas
,
s
=>
sizzle
(
`iq[to="
${
room_jid
}
"] query[node="x-roomuser-item"]`
,
s
.
nodeTree
).
length
).
pop
()
,
'
nodeTree
'
)
).
pop
()
);
}).
then
(
last_stanza
=>
{
// We empty the array, otherwise we might get stale stanzas
// returned in our filter above.
stanzas
.
length
=
0
;
}).
then
(
iq
=>
{
// We remove the stanza, otherwise we might get stale stanzas returned in our filter above.
stanzas
.
splice
(
stanzas
.
indexOf
(
iq
),
1
)
// The XMPP server returns the reserved nick for this user.
const
IQ_id
=
last_stanza
.
getAttribute
(
'
id
'
);
const
IQ_id
=
iq
.
nodeTree
.
getAttribute
(
'
id
'
);
const
stanza
=
$iq
({
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
,
...
...
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