Переглянути джерело

fix: Set affiliation. (#1966)

* fix: Set affiliation.

XEP-0045:
Affiliations are granted, revoked, and maintained based on the user’s bare JID, not the nick as with roles.

* squash: Fixes own revokeOwner.
release-8443
Дамян Минков 3 роки тому
джерело
коміт
b71481a8b2
Аккаунт користувача з таким Email не знайдено

+ 4
- 4
JitsiConference.js Переглянути файл

1721
     if (!participant) {
1721
     if (!participant) {
1722
         return;
1722
         return;
1723
     }
1723
     }
1724
-    this.room.setAffiliation(participant.getJid(), 'owner');
1724
+    this.room.setAffiliation(participant.getConnectionJid(), 'owner');
1725
 };
1725
 };
1726
 
1726
 
1727
 /**
1727
 /**
1735
     const role = this.isMembersOnly() ? 'member' : 'none';
1735
     const role = this.isMembersOnly() ? 'member' : 'none';
1736
 
1736
 
1737
     if (isMyself) {
1737
     if (isMyself) {
1738
-        this.room.setAffiliation(this.room.myroomjid, role);
1738
+        this.room.setAffiliation(this.connection.getJid(), role);
1739
     } else if (participant) {
1739
     } else if (participant) {
1740
-        this.room.setAffiliation(participant.getJid(), role);
1740
+        this.room.setAffiliation(participant.getConnectionJid(), role);
1741
     }
1741
     }
1742
 };
1742
 };
1743
 
1743
 
1744
-
1745
 /**
1744
 /**
1746
  * Kick participant from this conference.
1745
  * Kick participant from this conference.
1747
  * @param {string} id id of the participant to kick
1746
  * @param {string} id id of the participant to kick
1844
     const participant
1843
     const participant
1845
         = new JitsiParticipant(jid, this, nick, isHidden, statsID, status, identity);
1844
         = new JitsiParticipant(jid, this, nick, isHidden, statsID, status, identity);
1846
 
1845
 
1846
+    participant.setConnectionJid(fullJid);
1847
     participant.setRole(role);
1847
     participant.setRole(role);
1848
     participant.setBotType(botType);
1848
     participant.setBotType(botType);
1849
     participant.setFeatures(features);
1849
     participant.setFeatures(features);

+ 17
- 0
JitsiParticipant.js Переглянути файл

327
     setBotType(newBotType) {
327
     setBotType(newBotType) {
328
         this._botType = newBotType;
328
         this._botType = newBotType;
329
     }
329
     }
330
+
331
+    /**
332
+     * Returns the connection jid for the participant.
333
+     *
334
+     * @returns {string|undefined} - The connection jid of the participant.
335
+     */
336
+    getConnectionJid() {
337
+        return this._connectionJid;
338
+    }
339
+
340
+    /**
341
+     * Sets the connection jid for the participant.
342
+     * @param {String} newJid - The connection jid to set.
343
+     */
344
+    setConnectionJid(newJid) {
345
+        this._connectionJid = newJid;
346
+    }
330
 }
347
 }

+ 2
- 2
modules/xmpp/ChatRoom.js Переглянути файл

1230
         .c('query', { xmlns: 'http://jabber.org/protocol/muc#admin' })
1230
         .c('query', { xmlns: 'http://jabber.org/protocol/muc#admin' })
1231
         .c('item', {
1231
         .c('item', {
1232
             affiliation,
1232
             affiliation,
1233
-            nick: Strophe.getResourceFromJid(jid)
1233
+            jid: Strophe.getBareJidFromJid(jid)
1234
         })
1234
         })
1235
         .c('reason').t(`Your affiliation has been changed to '${affiliation}'.`)
1235
         .c('reason').t(`Your affiliation has been changed to '${affiliation}'.`)
1236
         .up().up().up();
1236
         .up().up().up();
1376
                             xmlns: 'http://jabber.org/protocol/muc#admin' })
1376
                             xmlns: 'http://jabber.org/protocol/muc#admin' })
1377
                         .c('item', {
1377
                         .c('item', {
1378
                             'affiliation': 'member',
1378
                             'affiliation': 'member',
1379
-                            'jid': m.jid
1379
+                            'jid': Strophe.getBareJidFromJid(m.jid)
1380
                         }).up().up());
1380
                         }).up().up());
1381
                 }
1381
                 }
1382
             });
1382
             });

+ 12
- 0
types/auto/JitsiParticipant.d.ts Переглянути файл

203
      */
203
      */
204
     setBotType(newBotType: string): void;
204
     setBotType(newBotType: string): void;
205
     _botType: string;
205
     _botType: string;
206
+    /**
207
+     * Returns the connection jid for the participant.
208
+     *
209
+     * @returns {string|undefined} - The connection jid of the participant.
210
+     */
211
+    getConnectionJid(): string | undefined;
212
+    /**
213
+     * Sets the connection jid for the participant.
214
+     * @param {String} newJid - The connection jid to set.
215
+     */
216
+    setConnectionJid(newJid: string): void;
217
+    _connectionJid: string;
206
 }
218
 }
207
 import { MediaType } from "./service/RTC/MediaType";
219
 import { MediaType } from "./service/RTC/MediaType";

Завантаження…
Відмінити
Зберегти