浏览代码

`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.
JC Brand 3 年之前
父节点
当前提交
25891ef0ee
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/headless/plugins/muc/occupants.js

+ 2 - 2
src/headless/plugins/muc/occupants.js

@@ -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);
         }