Merge pull request #2658 from urbit/mp/invite-search-lenience

invite search: avoid crashing with no associations
This commit is contained in:
Fang 2020-04-02 21:25:09 +02:00 committed by GitHub
commit 0578dc5643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 30 deletions

View File

@ -33,15 +33,15 @@ export class InviteSearch extends Component {
let groups = Array.from(Object.keys(this.props.groups)); let groups = Array.from(Object.keys(this.props.groups));
groups = groups.filter(e => !e.startsWith("/~/")) groups = groups.filter(e => !e.startsWith("/~/"))
.map(e => { .map(e => {
let eachGroup = new Set(); let eachGroup = [];
eachGroup.add(e); eachGroup.push(e);
if (this.props.associations) { if (this.props.associations) {
let name = e; let name = e;
if (e in this.props.associations) { if (e in this.props.associations) {
name = (this.props.associations[e].metadata.title !== "") name = (this.props.associations[e].metadata.title !== "")
? this.props.associations[e].metadata.title : e; ? this.props.associations[e].metadata.title : e;
} }
eachGroup.add(name); eachGroup.push(name);
} }
return Array.from(eachGroup); return Array.from(eachGroup);
}); });

View File

@ -31,20 +31,17 @@ export class InviteSearch extends Component {
peerUpdate() { peerUpdate() {
let groups = Array.from(Object.keys(this.props.groups)); let groups = Array.from(Object.keys(this.props.groups));
groups = groups groups = groups.filter(e => !e.startsWith("/~/"))
.filter(e => !e.startsWith("/~/"))
.map(e => { .map(e => {
let eachGroup = new Set(); let eachGroup = [];
eachGroup.add(e); eachGroup.push(e);
if (this.props.associations) { if (this.props.associations) {
let name = e; let name = e;
if (e in this.props.associations) { if (e in this.props.associations) {
name = name = (this.props.associations[e].metadata.title !== "")
this.props.associations[e].metadata.title !== "" ? this.props.associations[e].metadata.title : e;
? this.props.associations[e].metadata.title
: e;
} }
eachGroup.add(name); eachGroup.push(name);
} }
return Array.from(eachGroup); return Array.from(eachGroup);
}); });

View File

@ -31,20 +31,17 @@ export class InviteSearch extends Component {
peerUpdate() { peerUpdate() {
let groups = Array.from(Object.keys(this.props.groups)); let groups = Array.from(Object.keys(this.props.groups));
groups = groups groups = groups.filter(e => !e.startsWith("/~/"))
.filter(e => !e.startsWith("/~/"))
.map(e => { .map(e => {
let eachGroup = new Set(); let eachGroup = [];
eachGroup.add(e); eachGroup.push(e);
if (this.props.associations) { if (this.props.associations) {
let name = e; let name = e;
if (e in this.props.associations) { if (e in this.props.associations) {
name = name = (this.props.associations[e].metadata.title !== "")
this.props.associations[e].metadata.title !== "" ? this.props.associations[e].metadata.title : e;
? this.props.associations[e].metadata.title
: e;
} }
eachGroup.add(name); eachGroup.push(name);
} }
return Array.from(eachGroup); return Array.from(eachGroup);
}); });

View File

@ -31,20 +31,17 @@ export class InviteSearch extends Component {
peerUpdate() { peerUpdate() {
let groups = Array.from(Object.keys(this.props.groups)); let groups = Array.from(Object.keys(this.props.groups));
groups = groups groups = groups.filter(e => !e.startsWith("/~/"))
.filter(e => !e.startsWith("/~/"))
.map(e => { .map(e => {
let eachGroup = new Set(); let eachGroup = [];
eachGroup.add(e); eachGroup.push(e);
if (this.props.associations) { if (this.props.associations) {
let name = e; let name = e;
if (e in this.props.associations) { if (e in this.props.associations) {
name = name = (this.props.associations[e].metadata.title !== "")
this.props.associations[e].metadata.title !== "" ? this.props.associations[e].metadata.title : e;
? this.props.associations[e].metadata.title
: e;
} }
eachGroup.add(name); eachGroup.push(name);
} }
return Array.from(eachGroup); return Array.from(eachGroup);
}); });