Browse Source

Fix missing disco-items in session storage

This should fix #2925.
Johan Oudinet 3 năm trước cách đây
mục cha
commit
760f4f7dd1
2 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 1 0
      CHANGES.md
  2. 4 2
      src/headless/plugins/disco/entity.js

+ 1 - 0
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)
 

+ 4 - 2
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 });
             }
         });
     },