Merge pull request #2310 from urbit/mp/os1/invite-search-ship

chat, publish: invite-search surfaces valid ship name as result
This commit is contained in:
Logan 2020-02-19 13:48:43 -08:00 committed by GitHub
commit 11d8953873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -68,6 +68,18 @@ export class InviteSearch extends Component {
this.setState({
searchResults: { groups: groupMatches, ships: shipMatches }
});
let isValid = true;
if (!urbitOb.isValidPatp("~" + searchTerm)) {
isValid = false;
}
if ((shipMatches.length === 0) && (isValid)) {
shipMatches.push(searchTerm);
this.setState({
searchResults: { groups: groupMatches, ships: shipMatches }
})
}
}
}

View File

@ -69,6 +69,18 @@ export class InviteSearch extends Component {
this.setState({
searchResults: { groups: groupMatches, ships: shipMatches }
});
let isValid = true;
if (!urbitOb.isValidPatp("~" + searchTerm)) {
isValid = false;
}
if ((shipMatches.length === 0) && (isValid)) {
shipMatches.push(searchTerm);
this.setState({
searchResults: { groups: groupMatches, ships: shipMatches }
})
}
}
}