chat-js: pass in groups property, convert from permissions

This commit is contained in:
Logan Allen 2020-03-30 17:59:52 -04:00
parent 221238c0fa
commit c2070dbcc6
3 changed files with 12 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -30,7 +30,7 @@ export class InviteSearch extends Component {
}
peerUpdate() {
let groups = Array.from(Object.keys(this.props.permissions));
let groups = Array.from(Object.keys(this.props.groups));
groups = groups.filter(e => !e.startsWith("/~/"))
.map(e => {
let eachGroup = new Set();
@ -50,16 +50,16 @@ export class InviteSearch extends Component {
peerSet = new Set(),
contacts = new Map;
Object.keys(this.props.permissions).map(group => {
if (this.props.permissions[group].who.size > 0) {
let groupEntries = this.props.permissions[group].who.values();
Object.keys(this.props.groups).map(group => {
if (this.props.groups[group].size > 0) {
let groupEntries = this.props.groups[group].values();
for (let member of groupEntries) {
peerSet.add(member);
}
}
if (this.props.contacts[group]) {
let groupEntries = this.props.permissions[group].who.values();
let groupEntries = this.props.groups[group].values();
for (let member of groupEntries) {
if (this.props.contacts[group][member]) {
if (contacts.has(member)) {

View File

@ -216,6 +216,11 @@ export class NewScreen extends Component {
);
}
let groups = {};
Object.keys(props.permissions).forEach((pem) => {
groups[pem] = props.permissions[pem].who;
});
return (
<div
className={
@ -259,7 +264,7 @@ export class NewScreen extends Component {
Selected groups or ships will be able to post to chat
</p>
<InviteSearch
permissions={props.permissions}
groups={groups}
contacts={props.contacts}
associations={props.associations}
groupResults={true}