Update storing of app settings. Store settings in a closured
`app_settings` object inside `@converse/headless/shared/settings`
Remove the `_converse.settings` object.
The eventual goal is to avoid UI-related stanza processing if the relevant chats
aren't in the DOM.
With the current architecture, chatboxes are created (and the stanzas
related to them processed) even if `#conversejs` isn't in the DOM.
* Initial work on making controlbox an element
* Create a shared base class
* Ceate ChatBoxViews proxy
* Update sass now that certain classes are moved to converse-chats element
VCards were being created before `fetch` was completed, so once fetch
was done those VCards were unset from their collection.
Add a new event and promise `VCardsInitialized` that triggers after
successful fetching and wait for it before creating VCards.
Depend on latest backbone.browserStorage which has support for IndexedDB
via localforage.
Storage operations are now asynchronous and transactional.
Bugs fixed (mostly by waiting for operations to complete):
* Rooms are now fetched asynchronously, so wait before triggering `show`
or when closing.
* Make sure chat create/update transactions complete before firing events
* Make sure chats and messages have been fetched before creating new ones.
* When doing a `fetch` with `wait: false` on a collection and then
creating a model in that collection, then once the read
operation finishes (after creating the model), the collection is emptied again.
* Patch and wait when saving.
Otherwise we have previously set attributes overriding later ones.
* Make sure api.roomviews.close returns a promise
Test fixes:
* Chats are now asynchronously returned, so we need to use `await`
* Wait for the storage transaction to complete when creating and updating messages
* Wait for all chatboxes to close
Otherwise we get sessionStorage inconsistencies due to the async nature of localforage.
* Wait for room views to close in spec/chatroom.js
In the process, remove the `closeAllChatBoxes` override in
converse-controlbox by letting the `close` method decide whether it
should be closed or not.
Since recently these tests have been failing consistently on Travis,
even though they're passing locally.
Ran out of time debugging the issue, so disabling some stuff for now.
- Combine all test init functions into `initConverse`
- Use `async` functions in more tests
- Replace `var` with `let` and `const` in more tests
- New utils method `toStanza` which converts a string to a Node
`toLocaleString` now returns element attributes in alphabetical order
(for better cross-browser consistency).
Also, `toLocaleString` is now used in favor of `outerHTML` because
browsers aren't consistent with one another in their output.