From bb03b6f278b70839d4a7854dcfb511e911d33241 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 10 May 2021 14:50:56 +1000 Subject: [PATCH] Invite: allow dismissal of join request Fixes urbit/landscape#782 --- .../src/views/components/Invite/Group.tsx | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/interface/src/views/components/Invite/Group.tsx b/pkg/interface/src/views/components/Invite/Group.tsx index 899e6f5966..4597cb7f97 100644 --- a/pkg/interface/src/views/components/Invite/Group.tsx +++ b/pkg/interface/src/views/components/Invite/Group.tsx @@ -206,8 +206,9 @@ function InviteActions(props: { app?: string; uid?: string; }) { - const { resource, api, app, uid } = props; + const { status, resource, api, app, uid } = props; const inviteAccept = useInviteAccept(resource, api, app, uid); + const set = useGroupState(s => s.set); const inviteDecline = useCallback(async () => { if (!(app && uid)) { @@ -216,15 +217,18 @@ function InviteActions(props: { await api.invite.decline(app, uid); }, [app, uid]); - const hideJoin = useCallback(async () => { - await api.groups.hide(resource); - }, [api, resource]); - - const { status } = props; - if (status) { - if(status.progress === 'done') { - return null; + const hideJoin = useCallback(async (e) => { + if(status?.progress === 'done') { + set(s => { + delete s.pendingJoin[resource] + }); + e.stopPropagation(); + return; } + await api.groups.hide(resource); + }, [api, resource, status]); + + if (status) { return ( - Cancel + {status?.progress === 'done' ? 'Dismiss' : 'Cancel'} );