瀏覽代碼

Remove unused method

JC Brand 4 月之前
父節點
當前提交
eb6237b26e

+ 0 - 8
src/headless/plugins/chat/model.js

@@ -145,14 +145,6 @@ class ChatBox extends ModelWithVCard(ModelWithMessages(ModelWithContact(ColorAwa
         }
     }
 
-    /**
-     * @param {string} jid1
-     * @param {string} jid2
-     */
-    isSameUser (jid1, jid2) {
-        return u.isSameBareJID(jid1, jid2);
-    }
-
     /**
      * @param {MessageAttributes} attrs
      */

+ 0 - 33
src/headless/plugins/muc/muc.js

@@ -1862,39 +1862,6 @@ class MUC extends ModelWithVCard(ModelWithMessages(ColorAwareModel(ChatBoxBase))
         }
     }
 
-    /**
-     * Given two JIDs, which can be either user JIDs or MUC occupant JIDs,
-     * determine whether they belong to the same user.
-     * @param {String} jid1
-     * @param {String} jid2
-     * @returns {Boolean}
-     */
-    isSameUser (jid1, jid2) {
-        const bare_jid1 = Strophe.getBareJidFromJid(jid1);
-        const bare_jid2 = Strophe.getBareJidFromJid(jid2);
-        const resource1 = Strophe.getResourceFromJid(jid1);
-        const resource2 = Strophe.getResourceFromJid(jid2);
-        if (u.isSameBareJID(jid1, jid2)) {
-            if (bare_jid1 === this.get('jid')) {
-                // MUC JIDs
-                return resource1 === resource2;
-            } else {
-                return true;
-            }
-        } else {
-            const occupant1 =
-                bare_jid1 === this.get('jid')
-                    ? this.occupants.findOccupant({ 'nick': resource1 })
-                    : this.occupants.findOccupant({ 'jid': bare_jid1 });
-
-            const occupant2 =
-                bare_jid2 === this.get('jid')
-                    ? this.occupants.findOccupant({ 'nick': resource2 })
-                    : this.occupants.findOccupant({ 'jid': bare_jid2 });
-            return occupant1 === occupant2;
-        }
-    }
-
     async isSubjectHidden () {
         const jids = await api.user.settings.get('mucs_with_hidden_subject', []);
         return jids.includes(this.get('jid'));

+ 2 - 0
src/headless/plugins/muc/occupant.js

@@ -35,6 +35,8 @@ class MUCOccupant extends ModelWithVCard(ModelWithMessages(ColorAwareModel(Model
 
     defaults() {
         return {
+            jid: undefined, // This is the user's real JID, if known
+            nick: undefined, // We use the nick to determine the occupant MUC JID
             hats: [],
             show: "offline",
             states: [],

+ 0 - 5
src/headless/types/plugins/chat/model.d.ts

@@ -370,11 +370,6 @@ declare class ChatBox extends ChatBox_base {
      * @returns {string|null}
      */
     getDisplayName(): string | null;
-    /**
-     * @param {string} jid1
-     * @param {string} jid2
-     */
-    isSameUser(jid1: string, jid2: string): any;
     /**
      * @param {MessageAttributes} attrs
      */

+ 0 - 8
src/headless/types/plugins/muc/muc.d.ts

@@ -706,14 +706,6 @@ declare class MUC extends MUC_base {
      * @param {MUCMessageAttributes} attrs
      */
     fetchFeaturesIfConfigurationChanged(attrs: import("./types").MUCMessageAttributes): void;
-    /**
-     * Given two JIDs, which can be either user JIDs or MUC occupant JIDs,
-     * determine whether they belong to the same user.
-     * @param {String} jid1
-     * @param {String} jid2
-     * @returns {Boolean}
-     */
-    isSameUser(jid1: string, jid2: string): boolean;
     isSubjectHidden(): Promise<any>;
     toggleSubjectHiddenState(): Promise<void>;
     /**

+ 2 - 0
src/headless/types/plugins/muc/occupant.d.ts

@@ -276,6 +276,8 @@ declare class MUCOccupant extends MUCOccupant_base {
      */
     initialize(): Promise<void>;
     defaults(): {
+        jid: any;
+        nick: any;
         hats: any[];
         show: string;
         states: any[];