Merge pull request #4014 from urbit/mp/landscape/namespacing

landscape: fix new chat creation 404; fix new resource clobbering
This commit is contained in:
matildepark 2020-11-24 20:00:19 -05:00 committed by GitHub
commit 729b0b5434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -69,7 +69,7 @@ export const Content = (props) => {
<Notifications {...props} />
)}
/>
<GraphApp {...props} />
<GraphApp path="/~graph" {...props} />
<Route
render={p => (
<ErrorComponent

View File

@ -173,6 +173,7 @@ export function GroupsPane(props: GroupsPaneProps) {
{...routeProps}
api={api}
baseUrl={baseUrl}
chatSynced={props.chatSynced}
associations={associations}
groups={groups}
group={groupPath}

View File

@ -38,6 +38,7 @@ interface NewChannelProps {
api: GlobalApi;
associations: Associations;
contacts: Rolodex;
chatSynced: any;
groups: Groups;
group?: string;
workspace: Workspace;
@ -49,7 +50,9 @@ export function NewChannel(props: NewChannelProps & RouteComponentProps) {
const waiter = useWaitForProps(props, 5000);
const onSubmit = async (values: FormSchema, actions) => {
const resId: string = stringToSymbol(values.name);
const resId: string = stringToSymbol(values.name)
+ ((workspace?.type !== 'home') ? `-${Math.floor(Math.random() * 10000)}`
: '');
try {
const { name, description, moduleType, ships } = values;
switch (moduleType) {
@ -95,6 +98,9 @@ export function NewChannel(props: NewChannelProps & RouteComponentProps) {
if (!group) {
await waiter(p => Boolean(p?.groups?.[`/ship/~${window.ship}/${resId}`]));
}
if (moduleType === 'chat') {
await waiter(p => Boolean(p?.chatSynced?.[`/~${window.ship}/${resId}`]));
}
actions.setStatus({ success: null });
const resourceUrl = parentPath(location.pathname);
history.push(
@ -126,8 +132,8 @@ export function NewChannel(props: NewChannelProps & RouteComponentProps) {
onSubmit={onSubmit}
>
<Form>
<Col
maxWidth="348px"
<Col
maxWidth="348px"
gapY="4"
>
<Col gapY="2">