Merge pull request #3667 from urbit/mp/launch/fix-group-invites

launch: accept group invites correctly
This commit is contained in:
matildepark 2020-10-07 15:33:39 -04:00 committed by GitHub
commit 9100b3c50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,14 @@ export default function Groups(props: GroupsProps & Parameters<typeof Box>[0]) {
.sort(sortGroupsAlph)
.sort(sortGroupsRecent(recentGroups))
const acceptInvite = (invite) => {
const [, , ship, name] = invite.path.split('/');
const resource = { ship, name };
return api.contacts.join(resource).then(() => {
api.invite.accept('/contacts', getKeyByValue(invites['/contacts'], invite));
});
};
return (
<Box
{...boxProps}
@ -77,7 +85,7 @@ export default function Groups(props: GroupsProps & Parameters<typeof Box>[0]) {
<Text display='inline-block' overflow='hidden' maxWidth='100%' style={{ textOverflow: 'ellipsis', whiteSpace: 'pre' }} title={invite.path.slice(6)}>{invite.path.slice(6)}</Text>
<Box pt='5'>
<Text
onClick={() => api.invite.accept('/contacts', getKeyByValue(invites['/contacts'], invite))}
onClick={() => acceptInvite(invite)}
color='blue'
mr='2'
cursor='pointer'>