Fixes #1772. Wait for roster to be fetched
This commit is contained in:
parent
1cba506bc7
commit
93d56898b7
|
@ -8,6 +8,7 @@
|
||||||
- #1691: Fix `collection.chatbox is undefined` errors
|
- #1691: Fix `collection.chatbox is undefined` errors
|
||||||
- #1733: New message notifications for a minimized chat stack on top of each other
|
- #1733: New message notifications for a minimized chat stack on top of each other
|
||||||
- #1757: Chats are hidden behind the controlbox on mobile
|
- #1757: Chats are hidden behind the controlbox on mobile
|
||||||
|
- #1772 `_converse.api.contact.add(jid, nick)` fails, says not a function
|
||||||
- Prevent editing of sent file uploads.
|
- Prevent editing of sent file uploads.
|
||||||
- Initial support for sending custom emojis. Currently only between Converse
|
- Initial support for sending custom emojis. Currently only between Converse
|
||||||
instances. Still working out a wire protocol for compatibility with other clients.
|
instances. Still working out a wire protocol for compatibility with other clients.
|
||||||
|
|
|
@ -1075,8 +1075,9 @@ converse.plugins.add('converse-roster', {
|
||||||
* @example
|
* @example
|
||||||
* _converse.api.contacts.add('buddy@example.com', 'Buddy')
|
* _converse.api.contacts.add('buddy@example.com', 'Buddy')
|
||||||
*/
|
*/
|
||||||
'add' (jid, name) {
|
async add (jid, name) {
|
||||||
if (!_.isString(jid) || !_.includes(jid, '@')) {
|
await _converse.api.waitUntil('rosterContactsFetched');
|
||||||
|
if (!_.isString(jid) || !jid.includes('@')) {
|
||||||
throw new TypeError('contacts.add: invalid jid');
|
throw new TypeError('contacts.add: invalid jid');
|
||||||
}
|
}
|
||||||
_converse.roster.addAndSubscribe(jid, _.isEmpty(name)? jid: name);
|
_converse.roster.addAndSubscribe(jid, _.isEmpty(name)? jid: name);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user