Commit Graph

89 Commits

Author SHA1 Message Date
JC Brand
c750748b8d Only create new message models once messages have been fetched
Fixes #2241
2020-10-29 10:36:28 +01:00
JC Brand
c08ee00fcd Enforce uni-view in headless code
When we're showing only one chat at a time, we want to make sure that
all other chats have their `hidden` flag set to `true`.

Previously this was done in chatboxviews, but given that we want to
render UI based on state, this should be done in the headless part of
Converse.

As a result of the changes, the `beforeShowingChatView` has been
removed.
2020-10-27 13:00:43 +01:00
JC Brand
8c1e886af9 Fixes #2302 Bookmarks get duplicated on server push 2020-10-23 16:22:40 +02:00
JC Brand
5350cb107f Don't throw timeout errors for sent IQ#result or IQ#error stanzas 2020-09-25 14:12:12 +02:00
JC Brand
16ca8044f8 Add experimental support for running the XMPP conneciton inside a shared worker
Still lacks inter-tab communication to update state across tabs, i.e.
when sending a 1-on-1 message in one tab, it doesn't appear in another,
because that information is not available via the websocket connection.

- Create a new `Connection` class that extends Strophe.Connection and
    move related code from `converse-core.js` into this class.
- Store the session in localStorage when using a worker
- Move XEP-0156 code to connection.js
    This allows us to initialize the connection without needing to know the
    domain.
2020-07-27 12:43:47 +02:00
JC Brand
4b270359f6 Use Karma as test runner 2020-04-23 11:55:51 +02:00
JC Brand
7e23adf26f Remove the need for require.js to run tests 2020-04-22 12:10:39 +02:00
JC Brand
531ebf335c Properly test and fix show/hide of MUC topic 2020-04-06 15:27:32 +02:00
JC Brand
c20dbbbbbd Store in user settings whether a MUC topic is hidden or not 2020-03-31 22:57:22 +02:00
JC Brand
3400acbfeb Show MUC buttons in a dropdown menu
- Get rid of the ChatBoxHeading class
- Add support for showing standalone buttons in overlay viewmode
2020-02-13 20:57:47 +01:00
JC Brand
b0a9782d31 emoji: Lazy load the emoji JSON
Only load it once the first chat has been opened.
2020-01-21 12:45:34 +01:00
JC Brand
8b6c902c4c Set VCards via events, thereby reducing coupling
- Rename `chatRoomOpened` event to `chatRoomViewInitialized`
- Rename `chatBoxInitialized` to `chatBoxViewInitialized` and trigger only for `ChatBoxView` instances.
- New event `headlinesBoxViewInitialized`
- Trigger the `chatBoxInitialized` event when a new `_converse.ChatBox` is opened.
2019-12-18 15:20:51 +01:00
JC Brand
3d3738f3be muc: refactor MUC joining
We now distinguish more clearly between joining and re-joining a MUC.

The `enterRoom` method has been refactored away.

Instead, `join` or `rejoin` should be used, depending on the circumstances.

Don't fetch cached occupants in the `initialize` function, instead, only fetch
them if we're restoring a MUC that we're still connected to.

If we're not restoring a still-connected MUC, then we clear the
occupants cache, and the messages cache if `clear_messages_on_reconnection` is `true`.

updates #1807
updates #1808
2019-12-09 17:17:33 +01:00
JC Brand
4b3d427cff muc: only create view once model has finished initialization 2019-11-22 13:50:36 +01:00
JC Brand
879e165ae5 Refactoring
- Move headless one-on-one chat functionality into converse-chat
- Split converse-headline into converse-headlines and converse-headlines-views
- Add api in `_converse.api.chatboxes` for creating chatboxes
- Add `_converse.api.controlbox.get` method
2019-11-04 15:05:50 +01:00
JC Brand
1fa203c990 Support for IndexedDB. updates #1105
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.
2019-10-30 13:02:23 +01:00
JC Brand
bcd39a7ff4 Use utility method in tests 2019-10-13 19:51:44 +02:00
JC Brand
877e07775a Remove need to pass in spies to initConverse
They aren't used anymore.
2019-10-11 17:46:13 +02:00
JC Brand
9d77a4ef97 Fixes #129 Add support for XEP-0156.
Only XML is supported for now.
2019-10-11 17:46:13 +02:00
JC Brand
b63b080419 chatboxes: wait until messages are fixed before returning new chatbox
Fixes #1691
2019-10-10 14:44:13 +02:00
JC Brand
8780f7a128 Fix linting errors (no-unused-vars) 2019-10-09 16:27:58 +02:00
JC Brand
4cb9fd88a8 Refactor emojis so that JSON is fetch asynchronously 2019-08-22 13:56:47 +02:00
JC Brand
e20b654876 Stop using _.isUndefined 2019-07-29 10:32:29 +02:00
JC Brand
3a2bf766a0 Add new test utility waitUntilBookmarksReturned 2019-07-12 10:38:07 +02:00
JC Brand
a1630b5c1f Replace wait-until-promise with utility method
and bump default timeout

Also let `_converse.api.waitUntil` use it if a function is passed in.
2019-07-11 23:34:27 +02:00
JC Brand
98215deb21 Update to latest backbone.overview which debounces sorting on add event 2019-06-27 13:15:55 +02:00
JC Brand
737e27c726 Use shakespearean character names in tests 2019-06-03 09:43:24 +02:00
JC Brand
da713f3162 Improve chatroom name rendering
- Take locked_muc_domain into consideration in chatroom display name
- Use getDisplayName when rendering the heading name
- Give preference to bookmark name if it exists
2019-05-29 13:27:41 +02:00
JC Brand
9cb9151265 Add test to check that #1577 is resolved 2019-05-21 12:05:47 +02:00
JC Brand
5532a9ec63 Remove jquery from tests 2019-04-08 21:45:09 +02:00
JC Brand
f897703565 Rename emit to trigger for consistency with Backbone.Events 2019-03-29 21:56:56 +01:00
JC Brand
298300e890 Add test for muc_respect_autojoin 2019-03-27 08:34:52 +01:00
JC Brand
519bd54acb Fixes #1457. Wrong tooltip shown for "unbookmark" icon 2019-02-26 12:08:48 +01:00
JC Brand
dfe9d301c6 Test that roster groups are fetched before contacts
updates #1405
2019-02-13 11:20:49 +01:00
JC Brand
9f5031c278 Make converse.initialize an async function
- 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
2019-02-12 15:34:50 +01:00
JC Brand
c22fe41aef Use async/await in tests 2018-11-22 14:25:56 +01:00
JC Brand
53b3f2d0d6 Fix failing tests and rewrite to use async/await 2018-10-26 12:53:24 +02:00
JC Brand
9bc8bdf34c Test updates after updating to use latest strophe.js
`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.
2018-10-03 21:11:20 +02:00
JC Brand
2acc11f776 Fixes #1158. Fall back to bookmark JID if name is not available 2018-09-06 17:25:10 +02:00
JC Brand
18c7ba4ad8 Bugfix. Need to first create bookmark
Otherwise we don't include it in the stanza.
So if an error occurs, remove the bookmark again.
2018-08-31 11:24:05 +02:00
JC Brand
4c3645c559 Merge branch 'master' into converse-omemo 2018-08-03 14:47:20 +02:00
JC Brand
506aa33131 Wait for promises before opening chats in API methods 2018-08-01 11:12:00 +02:00
JC Brand
bf13927946 Merge branch 'master' into converse-omemo 2018-07-21 11:34:51 +02:00
JC Brand
7b86e24b9a Add missing CSS class to bookmark list item and fix test
updates #1069
2018-07-04 11:24:02 +02:00
JC Brand
6785eff4a7 Merge branch 'master' into converse-omemo 2018-07-01 11:44:04 +02:00
JC Brand
cc98cea009 Fix failing tests by waiting appropriately 2018-06-30 14:01:47 +02:00
JC Brand
596082eecc Get tests to run agains the webpack build 2018-06-03 16:40:20 +02:00
JC Brand
ddd0ef8e20 Test that device lists can get updated via PEP
Fix various bugs in the process.

updates #497
2018-05-23 12:51:01 +02:00
JC Brand
6a12a96e85 Fixes #1043 Parsing of bookmarks fail with missing nick element. 2018-03-30 14:23:39 +02:00
JC Brand
56e28070b2 Fix failing test 2018-03-16 19:48:31 +00:00