Merge pull request #5576 from urbit/lf/no-perms-rejoin

groups: fix rejoining a group after an error
This commit is contained in:
Hunter Miller 2022-02-03 14:27:52 -06:00 committed by GitHub
commit 2d95a34f7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 9 deletions

View File

@ -143,6 +143,8 @@ function PendingGroup(props: PendingGroupProps) {
<Box>
{!joining ? (
<Text color="blue">Invited</Text>
) : joining === 'no-perms' || joining == 'strange' ? (
<Text color="red">Join Failed</Text>
) : joining !== "done" ? (
<Text gray>Joining...</Text>
) : (

View File

@ -150,22 +150,38 @@ function JoinError(props: {
desc: JoinDesc;
request: JoinRequest;
modal: boolean;
dismiss: () => void;
}) {
const { desc, request, modal } = props;
const { dismiss, desc, request, modal } = props;
const { preview } = usePreview(desc.group);
const group = preview?.metadata?.title ?? desc.group;
const title = `Joining ${group} failed`;
const explanation =
request.progress === 'no-perms'
? 'You do not have the correct permissions'
: 'An unexpected error occurred';
: 'An unexpected error occurred';
const onRetry = () => {
useGroupState.getState().abortJoin(desc.group);
const [,,ship,name] = group.split('/');
airlock.poke(
join(ship, name, desc.kind, false, false)
);
};
const onAbort = () => {
useGroupState.getState().abortJoin(desc.group);
dismiss();
};
return (
<JoinSkeleton modal={modal} title={title} desc={desc}>
<Col p='4' gapY='4'>
<Text fontWeight='medium'>{explanation}</Text>
<Row>
<Button>Dismiss</Button>
<Row gapX="2">
<Button onClick={onRetry} primary>Retry</Button>
<Button onClick={onAbort} destructive>Abort</Button>
</Row>
</Col>
</JoinSkeleton>
@ -233,7 +249,7 @@ export function Join(props: JoinProps) {
finished={finishedPath}
/>
) : isErrored ? (
<JoinError modal={modal} desc={desc} request={openedRequest} />
<JoinError dismiss={dismiss} modal={modal} desc={desc} request={openedRequest} />
) : (
<JoinInitial modal={modal} dismiss={dismiss} desc={desc} invite={invite} />
);

View File

@ -295,12 +295,14 @@
::
++ rollback
|^
=/ =request:view (~(got by joining) rid)
=/ =request:view (~(got by joining) rid)
?+ progress.request ~|(cannot-rollback/progress.request !!)
%start start
%added added
%metadata metadata
%start start
%added added
%metadata metadata
?(%no-perms %strange %abort) error
==
++ error jn-core
++ start jn-core
++ added (emit del-us:pass)
++ metadata (emit:added remove-pull-groups:pass)