From 141e1637fe279394a44da0bef6123c4e738eee4d Mon Sep 17 00:00:00 2001 From: Christoph Scholz Date: Sun, 31 Aug 2025 16:27:34 +0200 Subject: [PATCH] fix remove bookmark --- CHANGES.md | 4 +++ src/headless/plugins/bookmarks/collection.js | 26 +++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index fda5c078aa..e5e070e127 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/src/headless/plugins/bookmarks/collection.js b/src/headless/plugins/bookmarks/collection.js index ddf6879051..508cf1fa4f 100644 --- a/src/headless/plugins/bookmarks/collection.js +++ b/src/headless/plugins/bookmarks/collection.js @@ -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 ); @@ -182,6 +184,28 @@ class Bookmarks extends Collection { }); } + /** + * @param {Bookmark} bookmark + * @returns {Promise} + */ + 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` + + + + + + + `; + await api.sendIQ(stanza); + } + /** * @param {Element} iq */