Merge pull request #719 from msgmaxim/private-groups

Fix not showing non-friend members in update group dialog
pull/721/head
Maxim Shishmarev 5 years ago committed by GitHub
commit 09bfd9e4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -105,19 +105,19 @@
this.isAdmin = groupConvo.get('groupAdmins').includes(ourPK);
const convos = window.getConversations().models;
let allMembers = convos.filter(d => !!d);
allMembers = allMembers.filter(
d => d.isFriend() && d.isPrivate() && !d.isMe()
);
allMembers = _.uniq(allMembers, true, d => d.id);
const convos = window.getConversations().models.filter(d => !!d);
this.friendList = allMembers;
// only give members that are not already in the group
let existingMembers = groupConvo.get('members');
// Show a contact if they are our friend or if they are a member
let friendsAndMembers = convos.filter(
d =>
(d.isFriend() || existingMembers.includes(d.id)) &&
d.isPrivate() &&
!d.isMe()
);
this.friendsAndMembers = _.uniq(friendsAndMembers, true, d => d.id);
// at least make sure it's an array
if (!Array.isArray(existingMembers)) {
existingMembers = [];
@ -137,7 +137,7 @@
window.storage.get('primaryDevicePubKey')
);
// zero out friendList for now
this.friendList = [];
this.friendsAndMembers = [];
this.existingMembers = [];
}
@ -155,7 +155,7 @@
isPublic: this.isPublic,
cancelText: this.cancelText,
existingMembers: this.existingMembers,
friendList: this.friendList,
friendList: this.friendsAndMembers,
isAdmin: this.isAdmin,
onClose: this.close,
onSubmit: this.onSubmit,

@ -20,7 +20,7 @@ interface Props {
// friends not in the group
friendList: Array<any>;
isAdmin: boolean;
existingMembers: Array<any>;
existingMembers: Array<String>;
i18n: any;
onSubmit: any;
onClose: any;

Loading…
Cancel
Save