We now no longer have an `.items` collection on a disco entity.
Instead, add a new API method `api.disco.entities.items` should be used.
This should solve the issue of the entities disappearing when reloading
the page.
Updates #2925
When calling `api.supports(feature, entity_jid)`, it checks whether the entity
supports the feature or whether any of the sub-items on the entity
supports that feature.
However, on `DiscoEntity`, the `waitUntilFeaturesDiscovered` promise
didn't wait for the items on the entity to be fetched, and was therefore
resolved too quickly.
This caused the file upload button to not render.
Updates #2925
Previously we tried to remember whether carbons were enabled before by
saving a flag in the session storage, but apparently this resulted in
false positives and carbons then not being enabled.
With carbons not enabled, clients don't get sent messages.
I don't like the idea of enabling carbons every time the page reloads,
but the alternative is lost messages which is way worse.
I think the issue is that it's not possible to guarantee that the
session is always properly cleared. For example if Converse crashes, and
then the page is reloaded, the session will wrongly indicate that
carbons have been enabled, even though they won't be.
The fix from @joudinet was to call `this.items.create` on `DiscoEntity`,
however we still need to pass in the same `entity` model as before so that both
collections (`this.items` and `_converse.disco_entities`) have a
referene to the same model.
That way, when attributes like `.identities` are added on the entity,
it's available from both `this.items` and `_converse.disco_entities`.
if the occupant can't be found via XEP-0421 occupant id.
We cannot safely assume that an occupant found via nick/jid but without
the same occupant id is the same occupant.
- Move template to relevant plugin
- Turn ElementView into CustomElement
- Use the terminology "Headlines Feed" instead of "Headlines Box"
- Break the `converse-headlines` plugin up into multiple files
- Fix CSS styling for headlines feeds for the Dracula theme
- Remove the `converse-carbons` plugin and make carbons part of the `converse-chat` plugin.
- Remove the `message_carbons` configuration setting. Carbons are now always enabled.
(Although they do load when using converse.min.js)
I wasn't able to figure out why exactly, but setting `mode` to
`production` for the `converse.js` build solved the issue.
Had to add `src/strophe-shims.js` as a webpack alias to the shims.js
file in Strophe because the usage of `require` to load Node.js packags
in shims.js is causing problems with Webpack 5.
Set postcss-clean to 1.2.0 to fix the build error `node.getIterator() is
not a function`
Upgrade to latest Webpack
insofar we have an `occupant_id`.
We do this by subclassing `create` on the `ChatRoomOccupants` collection
and `save` on the `ChatRoomOccupant` model, to make sure that whenever
an occupant is created or saved, that the `id` matches the `occupant_id`
value if it's available.
This lets us look up the occupant via `occupant_id` via dictionary lookup,
instead of array traversal.
Another change is to save `from_real_jid` when adding an occupant to a message
When there is a circular dependency between disco entities (via their
advertised `disco#items`), Converse went into an infinite loop because
even though there was a check whether an entity already existed, it
failed to add newly created entities to the global
`_converse.disco_entities` collection.
and not in the muc plugin.
This decouples the plugins more. Ideally we can remove the status plugin
entirely from a customized Converse build (but we're not there yet).
- Don't check the protocol in `checkFileTypes`, it should be doing one
thing only, and that is check whether the URL ends with a particular
file extension.
- Raise an error when a URI object can't be created from the passed in URL
Adds new function `isAllowedProtocolForMedia` which checks whether the
URL points to a file on the file system (`file:`), is in a Chrome
extension or uses HTTPs.
Use that in `shouldRenderMediaFromURL` to filter out URLs that shouldn't
be rendered.
Re-add utility methods to the `u` object so that 3rd party plugins can
use them.