Converse.js: Bookmarks do not update when other clients changes them

Created on 9 Oct 2020  路  7Comments  路  Source: conversejs/converse.js

Describe the bug
Assume that one user is online with two clients at the same time. At least one of those clients is converse.js. The other client can also be converse, but could be any client that stores its bookmarks in PEP.

Now, change the bookmarks (add, change, or remove a bookmark) in the "other" client (not converse.js).

Expected behavior
One would expect that the bookmarks as shown by Converse are modified to reflect the changes

Observed behavior
Converse does not pick up this change. Only when logging out and in again, the bookmarks are re-fetched.

To make things worse: when Converse is used to perform a second bookmark update, Converse will apply the change to the state of the bookmarks as it locally has (which excludes the changes made by the other client). By pushing its changes, the changes by the other client are overwritten/undone.

bug good first issue

Most helpful comment

Just to be clear, the fix is to add a new strophe namespace for storage:bookmarks via Strophe.addNameSpace (see other examples of that call in the codebase).

And then to call api.disco.own.features.add(Strophe.NS.BOOKMARKS+'+notify').

All of this should go into src/headless/converse-bookmarks.js

All 7 comments

The cause for this problem is a missing PEP notification filter.

Bookmarks, as used by Converse, are stored in a PEP node. When a PEP node is updated, notifications of that update are sent out, but _only_ to those resources that have expressed interest in that particular node. This mechanism is defined as 'notification filtering'. see https://xmpp.org/extensions/xep-0163.html#notify for details.

The solution to this issue seems to be easy: Converse should add to its XEP-0115 defined Entity Capabilities this feature: storage:bookmarks+notify

Is this as easy as adding storage:bookmarks+notify to the features, similar to how that's done with a couple of other features in this? https://github.com/conversejs/converse.js/blob/c9ba42d0a02d0b1c81ae42becc4f2e5588c01a9a/src/headless/converse-disco.js#L246-L264

@guusdk: yes I believe that's all that's required.

@bernard-ng do you want to pick up this issue?

yes yes 馃槉

Just to be clear, the fix is to add a new strophe namespace for storage:bookmarks via Strophe.addNameSpace (see other examples of that call in the codebase).

And then to call api.disco.own.features.add(Strophe.NS.BOOKMARKS+'+notify').

All of this should go into src/headless/converse-bookmarks.js

@jcbrand this issue is already fixed but still open

Was this page helpful?
0 / 5 - 0 ratings