address review: remove code duplication

pull/1074/head
Audric Ackermann 5 years ago
parent a3575c0295
commit 6d6f4a00e4
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -14,19 +14,12 @@
const convos = window.getConversations().models;
if (convo.isPublic()) {
this.friends = convos.filter(
d => !!d && d.isFriend() && d.isPrivate() && !d.isMe()
);
} else {
this.friends = convos.filter(
d =>
!!d &&
d.isFriend() &&
d.isPrivate() &&
!d.isMe() &&
!convo.get('members').includes(d.id)
);
this.friends = convos.filter(
d => !!d && d.isFriend() && d.isPrivate() && !d.isMe()
);
if (!convo.isPublic()) {
const members = convo.get('members') || [];
this.friends = this.friends.filter(d => !members.includes(d.id));
}
this.chatName = convo.get('name');

Loading…
Cancel
Save