Fix failing test.

The fix from @joudinet was to call `this.items.create` on `DiscoEntity`,
however we still need to pass in the same `entity` model as before so that both
collections (`this.items` and `_converse.disco_entities`) have a
referene to the same model.

That way, when attributes like `.identities` are added on the entity,
it's available from both `this.items` and `_converse.disco_entities`.
This commit is contained in:
JC Brand 2022-08-12 10:27:09 +02:00
parent 760f4f7dd1
commit fd9e41a917

View File

@ -142,11 +142,9 @@ 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;
if (!entities.get(jid))
entities.create({ jid, name });
this.items.create({ jid, name });
const entity = entities.get(jid) || entities.create({ jid, name: item.getAttribute('name') });
this.items.create(entity);
}
});
},