From 760f4f7dd13fdebff3685a3acaa641704ca013a3 Mon Sep 17 00:00:00 2001 From: Johan Oudinet Date: Mon, 4 Jul 2022 15:58:57 +0200 Subject: [PATCH] Fix missing disco-items in session storage This should fix #2925. --- CHANGES.md | 1 + src/headless/plugins/disco/entity.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fd9e023ab..b675ca926 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ - Update `nick` attribute on ChatRoom when user nickname changes - Restrict editing of MUC messages to ones with the same XEP-0421 occupant ID - #2936: Fix documentation about enable_smacks option, which is true by default. +- #2925: Fix missing disco-items in browser storage. ## 9.1.1 (2022-05-05) diff --git a/src/headless/plugins/disco/entity.js b/src/headless/plugins/disco/entity.js index 30d19a3e8..c615aef49 100644 --- a/src/headless/plugins/disco/entity.js +++ b/src/headless/plugins/disco/entity.js @@ -142,9 +142,11 @@ const DiscoEntity = Model.extend({ } const jid = item.getAttribute('jid'); if (this.items.get(jid) === undefined) { + const name = item.getAttribute('name'); const entities = _converse.disco_entities; - const entity = entities.get(jid) || entities.create({ jid, name: item.getAttribute('name') }); - this.items.add(entity); + if (!entities.get(jid)) + entities.create({ jid, name }); + this.items.create({ jid, name }); } }); },