Fixes #1043 Parsing of bookmarks fail with missing nick element.

This commit is contained in:
JC Brand 2018-03-28 13:00:46 +02:00
parent ce849aaffc
commit 6a12a96e85
2 changed files with 2 additions and 2 deletions

View File

@ -444,7 +444,7 @@
'name': 'Another room', 'name': 'Another room',
'autojoin': 'false', 'autojoin': 'false',
'jid': 'another@conference.shakespeare.lit' 'jid': 'another@conference.shakespeare.lit'
}).c('nick').t('JC').up().up(); }); // Purposefully exclude the <nick> element to test #1043
_converse.connection._dataRecv(test_utils.createRequest(stanza)); _converse.connection._dataRecv(test_utils.createRequest(stanza));
expect(_converse.bookmarks.models.length).toBe(2); expect(_converse.bookmarks.models.length).toBe(2);
expect(_converse.bookmarks.findWhere({'jid': 'theplay@conference.shakespeare.lit'}).get('autojoin')).toBe(true); expect(_converse.bookmarks.findWhere({'jid': 'theplay@conference.shakespeare.lit'}).get('autojoin')).toBe(true);

View File

@ -382,7 +382,7 @@
'jid': bookmark.getAttribute('jid'), 'jid': bookmark.getAttribute('jid'),
'name': bookmark.getAttribute('name'), 'name': bookmark.getAttribute('name'),
'autojoin': bookmark.getAttribute('autojoin') === 'true', 'autojoin': bookmark.getAttribute('autojoin') === 'true',
'nick': bookmark.querySelector('nick').textContent 'nick': _.get(bookmark.querySelector('nick'), 'textContent')
}); });
}); });
}, },