Fix not showing non-friend members in update group dialog

pull/719/head
Maxim Shishmarev 5 years ago
parent 5710c410c7
commit 0eda74d476

@ -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,

@ -31,7 +31,6 @@ class Mention extends React.Component<MentionProps, MentionState> {
}
public componentWillMount() {
this.setState({ found: false });
// TODO: give up after some period of time?

@ -18,7 +18,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