NewChannel: redirect DM creation from DM routes

We were redirecting based on our parent path, so if we were in a DM
while making a DM, we used that DM as our parent path.

Fixes urbit/landscape#421
This commit is contained in:
Matilde Park 2021-02-12 14:39:23 -05:00
parent 5db4c1307b
commit 6c2d935913

View File

@ -100,7 +100,7 @@ export function NewChannel(props: NewChannelProps & RouteComponentProps) {
await waiter(p => Boolean(p?.groups?.[`/ship/~${window.ship}/${resId}`]));
}
actions.setStatus({ success: null });
const resourceUrl = parentPath(location.pathname);
const resourceUrl = (location.pathname.includes("/messages")) ? "/~landscape/messages" : parentPath(location.pathname);
history.push(
`${resourceUrl}/resource/${moduleType}/ship/~${window.ship}/${resId}`
);