findOccupant: Don't fall back to nick/jid search...

if the occupant can't be found via XEP-0421 occupant id.

We cannot safely assume that an occupant found via nick/jid but without
the same occupant id is the same occupant.
This commit is contained in:
JC Brand 2022-06-20 14:33:44 +02:00
parent ba7c6d7a50
commit 25891ef0ee

View File

@ -98,7 +98,7 @@ class ChatRoomOccupants extends Collection {
* @typedef { Object} OccupantData
* @property { String } [jid]
* @property { String } [nick]
* @property { String } [occupant_id]
* @property { String } [occupant_id] - The XEP-0421 unique occupant id
*/
/**
* Try to find an existing occupant based on the passed in
@ -115,7 +115,7 @@ class ChatRoomOccupants extends Collection {
* @param { OccupantData } data
*/
findOccupant (data) {
if (data.occupant_id && this.get(data.occupant_id)) {
if (data.occupant_id) {
return this.get(data.occupant_id);
}