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
05e7cc85
Commit
05e7cc85
authored
Mar 14, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let `api.contacts.get` return the RosterContact model
parent
daff088c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
docs/source/developer_api.rst
docs/source/developer_api.rst
+3
-1
src/converse-core.js
src/converse-core.js
+4
-8
No files found.
docs/source/developer_api.rst
View file @
05e7cc85
...
...
@@ -695,7 +695,9 @@ To return all contacts, simply call ``get`` without any parameters:
});
The returned roster contact objects have these attributes:
The returned roster contact is a `Backbone.Model <http://backbonejs.org/#Model>`_ of type _converse.RosterContacts.
It has the following attributes (which should be accessed via `get <http://backbonejs.org/#Model-get>`_).
+----------------+-----------------------------------------------------------------------------------------------------------------+
| Attribute | |
...
...
src/converse-core.js
View file @
05e7cc85
...
...
@@ -1929,19 +1929,15 @@
},
'
contacts
'
:
{
'
get
'
(
jids
)
{
const
_transform
=
function
(
jid
)
{
const
contact
=
_converse
.
roster
.
get
(
Strophe
.
getBareJidFromJid
(
jid
));
if
(
contact
)
{
return
contact
.
attributes
;
}
return
null
;
const
_getter
=
function
(
jid
)
{
return
_converse
.
roster
.
get
(
Strophe
.
getBareJidFromJid
(
jid
))
||
null
;
};
if
(
_
.
isUndefined
(
jids
))
{
jids
=
_converse
.
roster
.
pluck
(
'
jid
'
);
}
else
if
(
_
.
isString
(
jids
))
{
return
_
transform
(
jids
);
return
_
getter
(
jids
);
}
return
_
.
map
(
jids
,
_
transform
);
return
_
.
map
(
jids
,
_
getter
);
},
'
add
'
(
jid
,
name
)
{
if
(
!
_
.
isString
(
jid
)
||
!
_
.
includes
(
jid
,
'
@
'
))
{
...
...
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