Lately we've been fetching messages only after entering the MUC, so that
we already have occupants to attach to them (due to `fetchMembers` being
called before) and thereby avoid rerenders.
I've now moved message fetching into the `initialize` method and added
missing event handlers for attaching/removing the occupant from a
message as it comes online or goes offline.
We still avoid (some) rerenders because we fetch and wait for cached
occupants before fetching cached messages and we wait for `fetchMembers`
before triggering `enteredNewRoom` which causes MAM messages to be
fetched.
in which you can set user affiliations and roles.
Also, let getAffiliationList return an Error instead of `null` if you're
not allowed to fetch a particular affiliation list.
Don't remove affiliation for occupants if we weren't allowed to
fetch that particular affiliation list.
Previously, if fetching the list failed, we would return an empty array,
which would imply that the affiliation list is empty and that all
users with the given affiliation should have their affiliations removed.
Instead we now return `null` and properly account for that when setting
affiliations on existing contacts based on the returned member lists.
* Explicit forwards and backwards paging
* Include upper or lower bound when calling `RSM.prototype.next` or `RSM.prototype.previous`
* Bugfix: Don't override new RSM parameters (caused infinite recursion)
If we've fetched the roster before within this session, then we don't
have to do so again, regardless of whether versioning is supported or
not, otherwise, even if we have a cached roster, we still need to get
the latest one again.
triggering connectionInitialized.
That way, when listening for `connectionInitialized`, we'll know when it
fires whether we've attached to a BOSH connection or not.
Instead optimize in other ways.
Also:
- Don't fade in when `animate` is false.
- `trimChats` now gets called in `afterShown`.
- Add now event `beforeShowingChatView`
Includes some refactoring:
- Don't send an `active` chat state notification when entering a MUC
I can't think of a good reason why this might be necessary or desired.
- Move `setChatState` form the view to the model
- Remove unused method `handleChatStateNotification`
- Don't store `role` and `affiliation` for the current user on the
ChatRoom object, but instead on the ChatRoomOccupant object representing
the user.
This change reverts the significant part of 1dfdb36d20
I can't say that I understand why libsignal throws `Error: Invalid signature`
when you try to build a session for your own (sending) device, but given that
messages can only be decrypted once, I guess it isn't really necessary
to encrypt for your own device, since you already have the plaintext.
In addition I've added some error handling so that we can recover
gracefully when session building fails for a subset of devices.
and re-enter if necessary.
This solves the problem where we "clone" a tab (e.g. middle-click) and
then restore a MUC from cache which we haven't actually entered (given
that the new tab represents a new device and session).
Also... add `await` in a test to try and fix Travis flakiness
Only fetch messages after we have the latest room features
Otherwise we run into race conditions where MAM messages are fetched
before we know whether (updated) the room supports MAM or not.
Unfortunately this doesn't work on Firefox and there's no proper
workaround. https://github.com/philipwalton/flexbugs/issues/108
Reverts:
Revert "Bugfix. Properly insert error messages and spinner"
This reverts commit 6a419cc145.
Revert "Use flexbox to keep the chat scrolled down"
This reverts commit dd91d3cc55.
By using `display: flex` and `flex-direction: column-reverse`, the chat
now automatically scrolls down when loaded, without requiring any
extra JavaScript.
We still need to scroll down with JavaScript when sending a message.
By using `column-reverse`, the messages container now works in reverse.
So the newest message is the first element in the container and the
oldest message is the last. This is the reverse of before.
Due to this, this change will likely break some plugins.
- Remove the `keepalive` configuration setting. It is now always implicitly `true`.
- Remove the `expose_rid_and_sid` configuration setting.
- A `prebind_url` is now mandatory when setting `authentication` to `prebind`.
- It's no longer possible to pass in `rid` and `sid` values to `converse.initialize.
* Checkmark and edit modal button are now on the right
* Instead of showing checkmarks for MUC messages,
we now show them as light grey before MUC reflection
* Simplify message markup by requiring less `if` statements
- New plugin `converse-smacks`
- New config option `enable_smacks`
- Rename session cache id from `converse.bosh-session` to `converse.session`
- Refactor logout and login as consistently used api methods
- Refactor session cache to store per JID
Fixes#316
- 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
and also first check whether we have an occupant with that nickname.
Since roles are session based, it doesn't make any sense to try to
modify the role for a user not in the room.
- new config option `singleton`.
- new plugin `converse-uniview`
- removed `converse-embedded`.
- various CSS changes, to properly render an embedded full app
- don't re-open cached and non-autojoined chats in singleton mode
The goal here is to extend the `embedded` `view_mode` so that the full app can
also be embedded, not just a single MUC or private chat.
To do this, we'll need to differentiate between multi and singleton chat apps.
* A singleton chat app contains only a single chat.
* A multi-chat app can contain zero or more chats
So we introduce a new config option, `singleton`, which when used with
`view_mode` set to `embedded` will determine whether a single chat or the full
app is embedded.
Similarly, in `overlayed`, `fullscreen` and `mobile` view modes, `singleton`
set to true will allow only one chat within the parameters of that view mode.
We're appropriating the word `singleton` and introducing the concepts of
`uniview` and `multiview` (see a785ca8) to cover what was
previously meant with `singleton`.
updates #1297
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.
- Use native `getTime` method instead of moment's `valueOf`
- Use toISOString() instead of moment().format()
This makes the code timezone independent since we're now globally using UTC.
That way we don't lose the user's input values, we avoid flashing and we
avoid unnecessary rendering.
In the process, fixed an annoying issue where Chrome auto-completes
what it thinks is the username into the "Language Tag" field of the MUC
config form.
Instead we tell Chrome that the MUC JID is the username, thereby also
letting it save the password to to that JID.
- Let box_id start with char for valid HTML.
- No need to use SHA1 for box id
- No need for the user_id attribute.
- Set nickname when we set the roster contact.
Also...
- _converse.api.contacts.get is now async
- _converse.api.chats.create is now async
Set reference to roster contact on the message and chatbox object and
listen for changes to the nickname.
Currently, because chat boxes are fetched and initialized before the
roster, messages and chats are repainted with the correct display name
only later, causing a "flash" effect.
Ideally we would only initialize the chat boxes after the roster
contacts have been fetched, but this is currently not easily possible
because we need the control box to render before everything else.
Instead of deleting devices that are not returned in the device list,
set an `active` flag, so that we don't remove the trust setting.
Set deactivated devices to `active` when a receive an OMEMO message from
it.
Also, set omemo_supported to true when we've succesfully decrypted a
message.
When set, the "Nickname" field won't be shown in the "Add groupchat"
modal and instead the nickname will be automatically set (based on other
config settings).
Until now, we've only been explicitly documenting the `_converse.api`
namespace and only considered the methods under it as forming the API
contract (which determines how we do semver releases).
It appears as if we've reached a point where trying to keep everything
under the `_converse.api` namespace no longer makes sense. Certain
methods are applicable to particular models and trying to shoehorn them
into the `_converse.api` namespace seems clunky and non-intuitive.
I've therefore decided to slightly refactor `sendMessage` to let it take
two simple parameters and to document it with JSDoc so that it's
presented as an API method, albeit only available on a chat model.
updates #1496
updates #1504
* Replace `tearDown` overrides with event handlers.
* Move presence listeners to `connected` event handler, otherwise they
don't get called when logging in again after disconnection.
* Add `clearSession` listeners to clean up upon disconnection.
* Use `Promise.all` instead of listening for multiple events.
- 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
Avoid `An 'url' property must be specified` error by properly clearing
presence data upon teardown and then resetting the browserStorage upon
reconnection.
Store contact resources in a Backbone collection
When OMEMO isn't possible, render it as grey.
This change makes OMEMO for MUCs easier, since there I anticipate that
OMEMO support might change dynamically based on who enters/exits the
room.
updates #1180
We distinguish between UniView and MultiView instances.
UniView means that only one chat is visible, even though there might be multiple ongoing chats.
MultiView means that multiple chats may be visible simultaneously.
This reverts commit 7af73c3471.
Doesn't look like the right approach for adding support for XEP-0156.
Work on that will continue in a branch in the meantime.
Namely:
- Only match messages which start with exactly "/me ".
- Simplify the match, checking a string instead of a complex regex.
- Always remove the first four characters in the case of a match, to not
leave an extra leading space.
So that we first render dynamic content (e.g. images) before inserting
it into the chat.
Also, add the `show_images_inline` setting (which is the cause of this
whole change).
Updated tests to handle this new change and start using async/await
instead of promise callbacks.
Previously we checked only if the last message was a join message from
the same person.
Now instead we check the last n messages that are join or leave
notifications.
`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.
- Move `getDefaultNickName` to the model and rename to `getDefaultNick`
- Let `checkForReservedNick` return a promise and save `nick` once received
- Updated `openAndEnterChatRoom` to wait appropriately and remove presence-wrapper
- Update tests to wait appropriately
- Remove presence-wrapper in `getRoomFeatures`
When receiving a PreKeySignalMessage, then a prekey has been chosen and
should now be removed from the list of available prekeys in the bundle,
so that a different device doesn't choose it as well.
AFAICT, libsignal removes the prekey, so it's then up to us to
regenerate it and republish our bundle.
updates #497
Before these changes, prekeys were stored in two places, one place that
converse-omemo accessed and one that libsignal accessed and when
libsignal deleted a prekey the other store wasn't updated.
Now we let the methods called by libsignal store/remove prekeys (and the
signed_prekey) in the same place as used by the code in converse-omemo.
Instead of setting `active` to `false`, we remove the device entirely
(unless its the current device).
Doing it this way means more fetching of bundles for devices that
disappear and then reappear from a user's devicelist.
However, there might be caching invalidation concerns with just reusing
a cached bundle for a device id that disappeared and then reappears.
Additionally this change simplifies the showing of a contact's device
fingerprints in the modal, since we don't have to take active/inactive
into consideration.
updates #497
The `_converse.session` store gets cleared after logout, but we want the
`trusted` flag to persist after logout.
Also update the documentation no that the `storage` config option has
been removed in favor of `trusted`.
So that it persists across page loads. Otherwise storage falls back to
the default, causing records to be in both local- and sessionStorage.
Additionally, update singleton models to have the 'id' available as a getter.
Otherwise multiple records gets stored in browserStorage, causing random
results being returned.
under non-OMEMO circumstances. Otherwise, when messages are fetched in
bulk via MAM, then a message referring to a previous one (e.g.
a correction) may be processed before the message being referred to has
been created.