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
768ed4a5
Commit
768ed4a5
authored
Sep 07, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace lodash methods with built-ins, convert docstrings to JSDoc
parent
ea22cdd7
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
73 additions
and
65 deletions
+73
-65
src/converse-minimize.js
src/converse-minimize.js
+1
-1
src/converse-muc-views.js
src/converse-muc-views.js
+11
-7
src/converse-oauth.js
src/converse-oauth.js
+1
-1
src/converse-omemo.js
src/converse-omemo.js
+4
-4
src/converse-register.js
src/converse-register.js
+3
-3
src/converse-rosterview.js
src/converse-rosterview.js
+27
-20
src/headless/converse-bookmarks.js
src/headless/converse-bookmarks.js
+1
-1
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+1
-1
src/headless/converse-core.js
src/headless/converse-core.js
+2
-2
src/headless/converse-disco.js
src/headless/converse-disco.js
+7
-9
src/headless/converse-muc.js
src/headless/converse-muc.js
+11
-11
src/headless/converse-roster.js
src/headless/converse-roster.js
+1
-1
src/headless/utils/core.js
src/headless/utils/core.js
+3
-4
No files found.
src/converse-minimize.js
View file @
768ed4a5
...
...
@@ -496,7 +496,7 @@ converse.plugins.add('converse-minimize', {
},
addMultipleChats
(
items
)
{
_
.
each
(
items
,
this
.
addChatView
.
bind
(
this
));
items
.
forEach
(
item
=>
this
.
addChatView
(
item
));
this
.
toggleview
.
model
.
set
({
'
num_minimized
'
:
this
.
keys
().
length
});
this
.
render
();
},
...
...
src/converse-muc-views.js
View file @
768ed4a5
...
...
@@ -192,10 +192,14 @@ converse.plugins.add('converse-muc-views', {
}));
}
/**
* Show/hide extra information about a groupchat in a listing.
* @function toggleRoomInfo
* @param { Event }
*/
function
toggleRoomInfo
(
ev
)
{
/* Show/hide extra information about a groupchat in a listing. */
const
parent_el
=
u
.
ancestor
(
ev
.
target
,
'
.room-item
'
),
div_el
=
parent_el
.
querySelector
(
'
div.room-info
'
);
const
parent_el
=
u
.
ancestor
(
ev
.
target
,
'
.room-item
'
);
const
div_el
=
parent_el
.
querySelector
(
'
div.room-info
'
);
if
(
div_el
)
{
u
.
slideIn
(
div_el
).
then
(
u
.
removeElement
)
parent_el
.
querySelector
(
'
a.room-info
'
).
classList
.
remove
(
'
selected
'
);
...
...
@@ -203,7 +207,7 @@ converse.plugins.add('converse-muc-views', {
parent_el
.
insertAdjacentHTML
(
'
beforeend
'
,
tpl_spinner
());
_converse
.
api
.
disco
.
info
(
ev
.
target
.
getAttribute
(
'
data-room-jid
'
),
null
)
.
then
(
stanza
=>
insertRoomInfo
(
parent_el
,
stanza
))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
.
catch
(
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
));
}
}
...
...
@@ -1312,7 +1316,7 @@ converse.plugins.add('converse-muc-views', {
this
.
showSpinner
();
this
.
model
.
fetchRoomConfiguration
()
.
then
(
iq
=>
this
.
renderConfigurationForm
(
iq
))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
.
catch
(
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
));
}
else
{
this
.
closeForm
();
}
...
...
@@ -2072,7 +2076,7 @@ converse.plugins.add('converse-muc-views', {
// Features could have been added before the controlbox was
// initialized. We're only interested in MUC
_converse
.
disco_entities
.
each
(
entity
=>
featureAdded
(
entity
.
features
.
findWhere
({
'
var
'
:
Strophe
.
NS
.
MUC
})));
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
}).
catch
(
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
));
}
function
fetchAndSetMUCDomain
(
controlboxview
)
{
...
...
@@ -2124,7 +2128,7 @@ converse.plugins.add('converse-muc-views', {
return
;
}
fetchAndSetMUCDomain
(
view
);
view
.
model
.
on
(
'
change:connected
'
,
_
.
partial
(
fetchAndSetMUCDomain
,
view
));
view
.
model
.
on
(
'
change:connected
'
,
()
=>
fetchAndSetMUCDomain
(
view
));
});
/************************ END Event Handlers ************************/
...
...
src/converse-oauth.js
View file @
768ed4a5
...
...
@@ -81,7 +81,7 @@ converse.plugins.add("converse-oauth", {
'
sync
'
:
function
sync
()
{},
initialize
()
{
_
.
each
(
_converse
.
user_settings
.
oauth_providers
,
(
provider
)
=>
{
_
converse
.
user_settings
.
oauth_providers
.
forEach
(
provider
=>
{
const
item
=
new
Backbone
.
Model
(
Object
.
assign
(
provider
,
{
'
login_text
'
:
__
(
'
Log in with %1$s
'
,
provider
.
name
)
}));
...
...
src/converse-omemo.js
View file @
768ed4a5
...
...
@@ -1022,8 +1022,8 @@ converse.plugins.add('converse-omemo', {
if
(
this
.
_devices_promise
===
undefined
)
{
this
.
_devices_promise
=
new
Promise
(
resolve
=>
{
this
.
devices
.
fetch
({
'
success
'
:
_
.
flow
(
c
=>
this
.
onDevicesFound
(
c
),
resolve
),
'
error
'
:
_
.
flow
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
),
resolve
)
'
success
'
:
c
=>
resolve
(
this
.
onDevicesFound
(
c
)
),
'
error
'
:
e
=>
{
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
resolve
();
}
});
});
}
...
...
@@ -1265,11 +1265,11 @@ converse.plugins.add('converse-omemo', {
_converse
.
api
.
listen
.
on
(
'
userDetailsModalInitialized
'
,
(
contact
)
=>
{
const
jid
=
contact
.
get
(
'
jid
'
);
_converse
.
generateFingerprints
(
jid
).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
_converse
.
generateFingerprints
(
jid
).
catch
(
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
));
});
_converse
.
api
.
listen
.
on
(
'
profileModalInitialized
'
,
(
contact
)
=>
{
_converse
.
generateFingerprints
(
_converse
.
bare_jid
).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
_converse
.
generateFingerprints
(
_converse
.
bare_jid
).
catch
(
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
));
});
_converse
.
api
.
listen
.
on
(
'
afterTearDown
'
,
()
=>
(
delete
_converse
.
omemo_store
));
...
...
src/converse-register.js
View file @
768ed4a5
...
...
@@ -142,10 +142,10 @@ converse.plugins.add('converse-register', {
_converse
.
api
.
waitUntil
(
'
controlBoxInitialized
'
).
then
(()
=>
{
const
controlbox
=
_converse
.
chatboxes
.
get
(
'
controlbox
'
)
controlbox
.
set
({
'
active-form
'
:
value
});
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}).
catch
(
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
FATAL
));
}
_converse
.
router
.
route
(
'
converse/login
'
,
_
.
partial
(
setActiveForm
,
'
login
'
));
_converse
.
router
.
route
(
'
converse/register
'
,
_
.
partial
(
setActiveForm
,
'
register
'
));
_converse
.
router
.
route
(
'
converse/login
'
,
()
=>
setActiveForm
(
'
login
'
));
_converse
.
router
.
route
(
'
converse/register
'
,
()
=>
setActiveForm
(
'
register
'
));
_converse
.
RegisterLinkView
=
Backbone
.
VDOMView
.
extend
({
...
...
src/converse-rosterview.js
View file @
768ed4a5
...
...
@@ -536,6 +536,11 @@ converse.plugins.add('converse-rosterview', {
}
});
/**
* @class
* @namespace _converse.RosterGroupView
* @memberOf _converse
*/
_converse
.
RosterGroupView
=
OrderedListView
.
extend
({
tagName
:
'
div
'
,
className
:
'
roster-group hidden
'
,
...
...
@@ -655,6 +660,7 @@ converse.plugins.add('converse-rosterview', {
* If all contacts are filtered out (i.e. hidden), then the
* group must be filtered out as well.
* @private
* @method _converse.RosterGroupView#filter
* @param { string } q - The query to filter against
* @param { string } type
*/
...
...
@@ -728,6 +734,11 @@ converse.plugins.add('converse-rosterview', {
});
/**
* @class
* @namespace _converse.RosterView
* @memberOf _converse
*/
_converse
.
RosterView
=
OrderedListView
.
extend
({
tagName
:
'
div
'
,
id
:
'
converse-roster
'
,
...
...
@@ -830,27 +841,21 @@ converse.plugins.add('converse-rosterview', {
},
filter
(
query
,
type
)
{
// First we make sure the filter is restored to its
// original state
_
.
each
(
this
.
getAll
(),
function
(
view
)
{
if
(
view
.
model
.
contacts
.
length
>
0
)
{
view
.
show
().
filter
(
''
);
}
});
const
views
=
Object
.
values
(
this
.
getAll
());
// First ensure the filter is restored to its original state
views
.
forEach
(
v
=>
(
v
.
model
.
contacts
.
length
>
0
)
&&
v
.
show
().
filter
(
''
));
// Now we can filter
query
=
query
.
toLowerCase
();
if
(
type
===
'
groups
'
)
{
_
.
each
(
this
.
getAll
(),
function
(
view
,
idx
)
{
if
(
!
_
.
includes
(
view
.
model
.
get
(
'
name
'
).
toLowerCase
(),
query
.
toLowerCase
()
))
{
views
.
forEach
(
view
=>
{
if
(
!
view
.
model
.
get
(
'
name
'
).
toLowerCase
().
includes
(
query
))
{
u
.
slideIn
(
view
.
el
);
}
else
if
(
view
.
model
.
contacts
.
length
>
0
)
{
u
.
slideOut
(
view
.
el
);
}
});
}
else
{
_
.
each
(
this
.
getAll
(),
function
(
view
)
{
view
.
filter
(
query
,
type
);
});
views
.
forEach
(
v
=>
v
.
filter
(
query
,
type
));
}
},
...
...
@@ -893,10 +898,14 @@ converse.plugins.add('converse-rosterview', {
this
.
updateFilter
();
},
getGroup
(
name
)
{
/
* Returns the group as specified by name.
/**
* Returns the group as specified by name.
* Creates the group if it doesn't exist.
* @method _converse.RosterView#getGroup
* @private
* @param {string} name
*/
getGroup
(
name
)
{
const
view
=
this
.
get
(
name
);
if
(
view
)
{
return
view
.
model
;
...
...
@@ -913,13 +922,11 @@ converse.plugins.add('converse-rosterview', {
let
groups
;
if
(
_converse
.
roster_groups
)
{
groups
=
contact
.
get
(
'
groups
'
);
if
(
groups
.
length
===
0
)
{
groups
=
[
_converse
.
HEADER_UNGROUPED
];
}
groups
=
(
groups
.
length
===
0
)
?
[
_converse
.
HEADER_UNGROUPED
]
:
groups
;
}
else
{
groups
=
[
_converse
.
HEADER_CURRENT_CONTACTS
];
}
_
.
each
(
groups
,
_
.
bind
(
this
.
addContactToGroup
,
this
,
contact
,
_
,
options
));
groups
.
forEach
(
g
=>
this
.
addContactToGroup
(
contact
,
g
,
options
));
},
addRosterContact
(
contact
,
options
)
{
...
...
@@ -965,7 +972,7 @@ converse.plugins.add('converse-rosterview', {
/* Place the rosterview inside the "Contacts" panel. */
_converse
.
api
.
waitUntil
(
'
rosterViewInitialized
'
)
.
then
(()
=>
view
.
controlbox_pane
.
el
.
insertAdjacentElement
(
'
beforeEnd
'
,
_converse
.
rosterview
.
el
))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
.
catch
(
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
FATAL
));
}
insertRoster
();
view
.
model
.
on
(
'
change:connected
'
,
insertRoster
);
...
...
src/headless/converse-bookmarks.js
View file @
768ed4a5
...
...
@@ -290,7 +290,7 @@ converse.plugins.add('converse-bookmarks', {
if
(
sizzle
(
'
event[xmlns="
'
+
Strophe
.
NS
.
PUBSUB
+
'
#event"] items[node="storage:bookmarks"]
'
,
message
).
length
)
{
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
)
.
then
(()
=>
_converse
.
bookmarks
.
createBookmarksFromStanza
(
message
))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
.
catch
(
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
FATAL
));
}
},
null
,
'
message
'
,
'
headline
'
,
null
,
_converse
.
bare_jid
);
...
...
src/headless/converse-chatboxes.js
View file @
768ed4a5
...
...
@@ -1461,7 +1461,7 @@ converse.plugins.add('converse-chatboxes', {
}
else
if
(
_
.
isString
(
jids
))
{
return
_converse
.
chatboxes
.
getChatBox
(
jids
);
}
return
jids
.
map
(
_
.
partial
(
_converse
.
chatboxes
.
getChatBox
.
bind
(
_converse
.
chatboxes
),
_
,
{},
true
));
return
jids
.
map
(
jid
=>
_converse
.
chatboxes
.
getChatBox
(
jid
,
{},
true
));
}
}
});
...
...
src/headless/converse-core.js
View file @
768ed4a5
...
...
@@ -1127,8 +1127,8 @@ _converse.initialize = async function (settings, callback) {
_converse
.
xmppstatus
=
new
this
.
XMPPStatus
({
'
id
'
:
id
});
_converse
.
xmppstatus
.
browserStorage
=
new
BrowserStorage
.
session
(
id
);
_converse
.
xmppstatus
.
fetch
({
'
success
'
:
_
.
partial
(
_converse
.
onStatusInitialized
,
reconnecting
),
'
error
'
:
_
.
partial
(
_converse
.
onStatusInitialized
,
reconnecting
),
'
success
'
:
()
=>
_converse
.
onStatusInitialized
(
reconnecting
),
'
error
'
:
()
=>
_converse
.
onStatusInitialized
(
reconnecting
),
'
silent
'
:
true
});
}
...
...
src/headless/converse-disco.js
View file @
768ed4a5
...
...
@@ -154,9 +154,9 @@ converse.plugins.add('converse-disco', {
},
onDiscoItems
(
stanza
)
{
_
.
each
(
sizzle
(
`query[xmlns="
${
Strophe
.
NS
.
DISCO_ITEMS
}
"] item`
,
stanza
),
(
item
)
=>
{
sizzle
(
`query[xmlns="
${
Strophe
.
NS
.
DISCO_ITEMS
}
"] item`
,
stanza
).
forEach
(
item
=>
{
if
(
item
.
getAttribute
(
"
node
"
))
{
// XXX:
i
gnore nodes for now.
// XXX:
I
gnore nodes for now.
// See: https://xmpp.org/extensions/xep-0030.html#items-nodes
return
;
}
...
...
@@ -191,9 +191,9 @@ converse.plugins.add('converse-disco', {
});
});
_
.
each
(
sizzle
(
`x[type="result"][xmlns="
${
Strophe
.
NS
.
XFORM
}
"]`
,
stanza
),
(
form
)
=>
{
sizzle
(
`x[type="result"][xmlns="
${
Strophe
.
NS
.
XFORM
}
"]`
,
stanza
).
forEach
(
form
=>
{
const
data
=
{};
_
.
each
(
form
.
querySelectorAll
(
'
field
'
),
(
field
)
=>
{
sizzle
(
'
field
'
,
form
).
forEach
(
field
=>
{
data
[
field
.
getAttribute
(
'
var
'
)]
=
{
'
value
'
:
_
.
get
(
field
.
querySelector
(
'
value
'
),
'
textContent
'
),
'
type
'
:
field
.
getAttribute
(
'
type
'
)
...
...
@@ -308,7 +308,7 @@ converse.plugins.add('converse-disco', {
iqresult
.
attrs
({
'
to
'
:
from
});
}
iqresult
.
c
(
'
query
'
,
attrs
);
_
.
each
(
plugin
.
_identities
,
(
identity
)
=>
{
plugin
.
_identities
.
forEach
(
identity
=>
{
const
attrs
=
{
'
category
'
:
identity
.
category
,
'
type
'
:
identity
.
type
...
...
@@ -321,9 +321,7 @@ converse.plugins.add('converse-disco', {
}
iqresult
.
c
(
'
identity
'
,
attrs
).
up
();
});
_
.
each
(
plugin
.
_features
,
(
feature
)
=>
{
iqresult
.
c
(
'
feature
'
,
{
'
var
'
:
feature
}).
up
();
});
plugin
.
_features
(
feature
=>
iqresult
.
c
(
'
feature
'
,
{
'
var
'
:
feature
}).
up
());
_converse
.
api
.
send
(
iqresult
.
tree
());
return
true
;
}
...
...
@@ -771,7 +769,7 @@ converse.plugins.add('converse-disco', {
* // The entity DOES NOT have this identity
* }
* }
* ).catch(
_.partial(_converse.log, _
, Strophe.LogLevel.FATAL));
* ).catch(
e => _converse.log(e
, Strophe.LogLevel.FATAL));
*/
async
getIdentity
(
category
,
type
,
jid
)
{
const
e
=
await
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
);
...
...
src/headless/converse-muc.js
View file @
768ed4a5
...
...
@@ -486,7 +486,7 @@ converse.plugins.add('converse-muc', {
const
storage
=
_converse
.
config
.
get
(
'
storage
'
);
const
id
=
`converse.muc-features-
${
_converse
.
bare_jid
}
-
${
this
.
get
(
'
jid
'
)}
`
;
this
.
features
=
new
Backbone
.
Model
(
_
.
assign
({
id
},
_
.
zipObject
(
converse
.
ROOM_FEATURES
,
_
.
map
(
converse
.
ROOM_FEATURES
,
_
.
stubFalse
)))
_
.
assign
({
id
},
_
.
zipObject
(
converse
.
ROOM_FEATURES
,
converse
.
ROOM_FEATURES
.
map
(
_
.
stubFalse
)))
);
this
.
features
.
browserStorage
=
new
BrowserStorage
.
session
(
id
);
},
...
...
@@ -848,7 +848,7 @@ converse.plugins.add('converse-muc', {
const
features
=
await
_converse
.
api
.
disco
.
getFeatures
(
this
.
get
(
'
jid
'
));
const
attrs
=
Object
.
assign
(
_
.
zipObject
(
converse
.
ROOM_FEATURES
,
_
.
map
(
converse
.
ROOM_FEATURES
,
_
.
stubFalse
)),
_
.
zipObject
(
converse
.
ROOM_FEATURES
,
converse
.
ROOM_FEATURES
.
map
(
_
.
stubFalse
)),
{
'
fetched
'
:
(
new
Date
()).
toISOString
()}
);
features
.
each
(
feature
=>
{
...
...
@@ -900,8 +900,8 @@ converse.plugins.add('converse-muc', {
* has return a response IQ.
*/
saveConfiguration
(
form
)
{
const
inputs
=
form
?
sizzle
(
'
:input:not([type=button]):not([type=submit])
'
,
form
)
:
[]
,
configArray
=
_
.
map
(
inputs
,
u
.
webForm2xForm
);
const
inputs
=
form
?
sizzle
(
'
:input:not([type=button]):not([type=submit])
'
,
form
)
:
[]
;
const
configArray
=
inputs
.
map
(
u
.
webForm2xForm
);
return
this
.
sendConfiguration
(
configArray
);
},
...
...
@@ -1283,7 +1283,7 @@ converse.plugins.add('converse-muc', {
}
const
occupant
=
this
.
occupants
.
findOccupant
(
data
);
if
(
data
.
type
===
'
unavailable
'
&&
occupant
)
{
if
(
!
_
.
includes
(
data
.
states
,
converse
.
MUC_NICK_CHANGED_CODE
)
&&
!
occupant
.
isMember
())
{
if
(
!
data
.
states
.
includes
(
converse
.
MUC_NICK_CHANGED_CODE
)
&&
!
occupant
.
isMember
())
{
// We only destroy the occupant if this is not a nickname change operation.
// and if they're not on the member lists.
// Before destroying we set the new data, so
...
...
@@ -1575,7 +1575,7 @@ converse.plugins.add('converse-muc', {
},
handleDisconnection
(
stanza
)
{
const
is_self
=
!
_
.
isNull
(
stanza
.
querySelector
(
"
status[code='110']
"
))
;
const
is_self
=
stanza
.
querySelector
(
"
status[code='110']
"
)
!==
null
;
const
x
=
sizzle
(
`x[xmlns="
${
Strophe
.
NS
.
MUC_USER
}
"]`
,
stanza
).
pop
();
if
(
!
x
)
{
return
;
...
...
@@ -1831,7 +1831,7 @@ converse.plugins.add('converse-muc', {
const
nick
=
this
.
get
(
'
nick
'
);
if
(
message
.
get
(
'
references
'
).
length
)
{
const
mentions
=
message
.
get
(
'
references
'
).
filter
(
ref
=>
(
ref
.
type
===
'
mention
'
)).
map
(
ref
=>
ref
.
value
);
return
_
.
includes
(
mentions
,
nick
);
return
mentions
.
includes
(
nick
);
}
else
{
return
(
new
RegExp
(
`\\b
${
nick
}
\\b`
)).
test
(
message
.
get
(
'
message
'
));
}
...
...
@@ -1894,7 +1894,7 @@ converse.plugins.add('converse-muc', {
}
vcards
.
push
(
_converse
.
vcards
.
findWhere
({
'
jid
'
:
this
.
get
(
'
from
'
)}));
_
.
forEach
(
_
.
filter
(
vcards
,
undefined
),
(
vcard
)
=>
{
vcards
.
filter
(
v
=>
v
).
forEach
(
vcard
=>
{
if
(
hash
&&
vcard
.
get
(
'
image_hash
'
)
!==
hash
)
{
_converse
.
api
.
vcard
.
update
(
vcard
,
true
);
}
...
...
@@ -2175,7 +2175,7 @@ converse.plugins.add('converse-muc', {
}
else
if
(
_
.
isString
(
jids
))
{
return
createChatRoom
(
jids
,
attrs
);
}
return
_
.
map
(
jids
,
_
.
partial
(
createChatRoom
,
_
,
attrs
));
return
jids
.
map
(
jid
=>
createChatRoom
(
jid
,
attrs
));
},
/**
...
...
@@ -2249,7 +2249,7 @@ converse.plugins.add('converse-muc', {
}
return
room
;
}
else
{
return
_
.
map
(
jids
,
jid
=>
_converse
.
api
.
rooms
.
create
(
jid
,
attrs
).
maybeShow
(
force
));
return
jids
.
map
(
jid
=>
_converse
.
api
.
rooms
.
create
(
jid
,
attrs
).
maybeShow
(
force
));
}
},
...
...
@@ -2297,7 +2297,7 @@ converse.plugins.add('converse-muc', {
if
(
_
.
isString
(
jids
))
{
return
getChatRoom
(
jids
,
attrs
);
}
return
_
.
map
(
jids
,
_
.
partial
(
getChatRoom
,
_
,
attrs
));
return
jids
.
map
(
jid
=>
getChatRoom
(
jid
,
attrs
));
}
}
});
...
...
src/headless/converse-roster.js
View file @
768ed4a5
...
...
@@ -519,7 +519,7 @@ converse.plugins.add('converse-roster', {
const
iq
=
$iq
({
'
type
'
:
'
set
'
})
.
c
(
'
query
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
ROSTER
})
.
c
(
'
item
'
,
{
jid
,
name
});
_
.
each
(
groups
,
group
=>
iq
.
c
(
'
group
'
).
t
(
group
).
up
());
groups
.
forEach
(
g
=>
iq
.
c
(
'
group
'
).
t
(
g
).
up
());
return
_converse
.
api
.
sendIQ
(
iq
);
},
...
...
src/headless/utils/core.js
View file @
768ed4a5
...
...
@@ -276,7 +276,7 @@ u.matchesSelector = function (el, selector) {
* @param { String } selector - the selector they should be matched against
*/
u
.
queryChildren
=
function
(
el
,
selector
)
{
return
_
.
filter
(
el
.
childNodes
,
_
.
partial
(
u
.
matchesSelector
,
_
,
selector
));
return
Array
.
from
(
el
.
childNodes
).
filter
(
el
=>
u
.
matchesSelector
(
el
,
selector
));
};
u
.
contains
=
function
(
attr
,
query
)
{
...
...
@@ -385,8 +385,7 @@ u.interpolate = function (string, o) {
* @private
* @method u#onMultipleEvents
* @param { Array } events: An array of objects, with keys `object` and
* `event`, representing the event name and the object it's
* triggered upon.
* `event`, representing the event name and the object it's triggered upon.
* @param { Function } callback: The function to call once all events have
* been triggered.
*/
...
...
@@ -400,7 +399,7 @@ u.onMultipleEvents = function (events=[], callback) {
triggered
=
[];
}
}
_
.
each
(
events
,
(
map
)
=>
map
.
object
.
on
(
map
.
event
,
handler
));
events
.
forEach
(
e
=>
e
.
object
.
on
(
e
.
event
,
handler
));
};
u
.
safeSave
=
function
(
model
,
attributes
)
{
...
...
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