File tree Expand file tree Collapse file tree
mobile/src/features/threads Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { useAtomValue } from "@effect/atom-react" ;
12import {
23 HANDOFF_LINK_DEFAULT_ACCESS ,
34 handoffLinkCandidates ,
@@ -100,8 +101,11 @@ function PendingHandoffRequest(props: {
100101 ) ;
101102 const options = targets . data ?. options ?? [ ] ;
102103 // Machines this client is connected to that the thread's environment has no link to yet.
104+ // Linking is changed on this thread's machine too, which this session may not be allowed to.
105+ const mayLinkHere = useAtomValue ( peerLinkEnvironment . link . permissionAtom ( props . environmentId ) ) ;
103106 const linkable = handoffLinkCandidates ( useLinkableMachines ( props . environmentId , true ) ) . filter (
104- ( machine ) => ! options . some ( ( option ) => option . environmentId === machine . environmentId ) ,
107+ ( machine ) =>
108+ mayLinkHere && ! options . some ( ( option ) => option . environmentId === machine . environmentId ) ,
105109 ) ;
106110 const pickedLinkable = linkable . find ( ( machine ) => machine . environmentId === picked ) ;
107111 // This device creates the link's code there, which its session must be allowed to.
Original file line number Diff line number Diff line change @@ -92,8 +92,11 @@ function PendingHandoffRequest(props: {
9292 // Machines this client is connected to and may link the thread's environment to itself.
9393 const candidates = handoffLinkCandidates ( useLinkableMachines ( props . environmentId , true ) ) ;
9494 const mayLink = useEnvironmentsWithScope ( candidates , AuthAccessWriteScope ) ;
95+ // Linking is changed on this thread's machine too, which this session may not be allowed to.
96+ const mayLinkHere = useAtomValue ( peerLinkEnvironment . link . permissionAtom ( props . environmentId ) ) ;
9597 const linkable = candidates . filter (
9698 ( machine ) =>
99+ mayLinkHere &&
97100 mayLink . has ( machine . environmentId ) &&
98101 ! options . some ( ( option ) => option . environmentId === machine . environmentId ) ,
99102 ) ;
You can’t perform that action at this time.
0 commit comments