Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 12.0.1 (Unreleased)

- #3823: Bookmark removal not working

## 12.0.0 (2025-08-28)

- #3581: Don't unnecessarily regenerate pot and po files
Expand Down
26 changes: 25 additions & 1 deletion src/headless/plugins/bookmarks/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class Bookmarks extends Collection {
this.on(
'remove',
/** @param {Bookmark} bookmark */
(_, bookmark) => this.sendBookmarkStanza(bookmark),
(bookmark, _) =>
this.removeBookmark(bookmark)
.catch((e) => log.fatal(e)),
this
);

Expand Down Expand Up @@ -182,6 +184,28 @@ class Bookmarks extends Collection {
});
}

/**
* @param {Bookmark} bookmark
* @returns {Promise<void|Element>}
*/
async removeBookmark(bookmark) {
const bare_jid = _converse.session.get('bare_jid');
const node = (await api.disco.supports(`${Strophe.NS.BOOKMARKS2}#compat`, bare_jid))
? Strophe.NS.BOOKMARKS2
: Strophe.NS.BOOKMARKS;
const stanza = stx`
<iq xmlns="jabber:client"
from="${bare_jid}"
type="set">
<pubsub xmlns="${Strophe.NS.PUBSUB}">
<retract node="${node}">
<item id="${bookmark.get('jid')}"/>
</retract>
</pubsub>
</iq>`;
await api.sendIQ(stanza);
}

/**
* @param {Element} iq
*/
Expand Down
Loading