|
@@ -2238,15 +2238,19 @@ converse.plugins.add('converse-muc', {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- async fetchMembers () {
|
|
|
|
|
|
+ getAutoFetchedAffiliationLists () {
|
|
const affs = _converse.muc_fetch_members;
|
|
const affs = _converse.muc_fetch_members;
|
|
- const all_affiliations = Array.isArray(affs) ? affs : (affs ? ['member', 'admin', 'owner'] : []);
|
|
|
|
- if (affs.length === 0) {
|
|
|
|
|
|
+ return Array.isArray(affs) ? affs : (affs ? ['member', 'admin', 'owner'] : []);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ async fetchMembers () {
|
|
|
|
+ const affiliations = this.getAutoFetchedAffiliationLists();
|
|
|
|
+ if (affiliations.length === 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const aff_lists = await Promise.all(all_affiliations.map(a => this.chatroom.getAffiliationList(a)));
|
|
|
|
|
|
+ const aff_lists = await Promise.all(affiliations.map(a => this.chatroom.getAffiliationList(a)));
|
|
const new_members = aff_lists.reduce((acc, val) => (u.isErrorObject(val) ? acc : [...val, ...acc]), []);
|
|
const new_members = aff_lists.reduce((acc, val) => (u.isErrorObject(val) ? acc : [...val, ...acc]), []);
|
|
- const known_affiliations = all_affiliations.filter(a => !u.isErrorObject(aff_lists[all_affiliations.indexOf(a)]));
|
|
|
|
|
|
+ const known_affiliations = affiliations.filter(a => !u.isErrorObject(aff_lists[affiliations.indexOf(a)]));
|
|
const new_jids = new_members.map(m => m.jid).filter(m => m !== undefined);
|
|
const new_jids = new_members.map(m => m.jid).filter(m => m !== undefined);
|
|
const new_nicks = new_members.map(m => !m.jid && m.nick || undefined).filter(m => m !== undefined);
|
|
const new_nicks = new_members.map(m => !m.jid && m.nick || undefined).filter(m => m !== undefined);
|
|
const removed_members = this.filter(m => {
|
|
const removed_members = this.filter(m => {
|