Переглянути джерело

Wait for roster to be initialized

JC Brand 4 роки тому
батько
коміт
d1abf3a04e

+ 2 - 0
src/headless/plugins/headlines.js

@@ -83,6 +83,8 @@ converse.plugins.add('converse-headlines', {
             // Handler method for all incoming messages of type "headline".
             if (isHeadline(stanza) || isServerMessage(stanza)) {
                 const from_jid = stanza.getAttribute('from');
+
+                await api.waitUntil('rosterInitialized')
                 if (from_jid.includes('@') &&
                         !_converse.roster.get(from_jid) &&
                         !api.settings.get("allow_non_roster_messaging")) {

+ 0 - 2
src/plugins/notifications/tests/notification.js

@@ -94,8 +94,6 @@ describe("Notifications", function () {
                     _converse.connection._dataRecv(mock.createRequest(stanza));
 
                     await u.waitUntil(() => _converse.chatboxviews.keys().length === 2);
-                    const view = _converse.chatboxviews.get('notify.example.com');
-                    await new Promise(resolve => view.model.messages.once('rendered', resolve));
                     expect(_converse.chatboxviews.keys().includes('notify.example.com')).toBeTruthy();
                     expect(window.Notification).toHaveBeenCalled();
                 }));