Merge pull request #3682 from urbit/mp/leap/home-workspace

groups, leap: redirect unmanaged resources correctly
This commit is contained in:
matildepark 2020-10-08 16:39:48 -04:00 committed by GitHub
commit 821b5eac79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View File

@ -37,7 +37,7 @@ const otherIndex = function() {
return other; return other;
}; };
export default function index(associations, apps, currentGroup) { export default function index(associations, apps, currentGroup, groups) {
// all metadata from all apps is indexed // all metadata from all apps is indexed
// into subscriptions and landscape // into subscriptions and landscape
const subscriptions = []; const subscriptions = [];
@ -75,9 +75,11 @@ export default function index(associations, apps, currentGroup) {
landscape.push(obj); landscape.push(obj);
} else { } else {
const app = each.metadata.module || each['app-name']; const app = each.metadata.module || each['app-name'];
const group = (groups[each['group-path']]?.hidden)
? '/home' : each['group-path'];
const obj = result( const obj = result(
title, title,
`/~landscape${each['group-path']}/join/${app}${each['app-path']}`, `/~landscape${group}/join/${app}${each['app-path']}`,
app.charAt(0).toUpperCase() + app.slice(1), app.charAt(0).toUpperCase() + app.slice(1),
(associations?.contacts?.[each['group-path']]?.metadata?.title || null) (associations?.contacts?.[each['group-path']]?.metadata?.title || null)
); );

View File

@ -150,6 +150,7 @@ class App extends React.Component {
apps={state.launch} apps={state.launch}
api={this.api} api={this.api}
dark={state.dark} dark={state.dark}
groups={state.groups}
show={state.omniboxShown} show={state.omniboxShown}
/> />
</ErrorBoundary> </ErrorBoundary>

View File

@ -25,10 +25,10 @@ function isJoined(app: string, path: string) {
props: Pick<UnjoinedResourceProps, "inbox" | "graphKeys" | "notebooks"> props: Pick<UnjoinedResourceProps, "inbox" | "graphKeys" | "notebooks">
) { ) {
let ship, name; let ship, name;
const graphKey = path.substr(7);
switch (app) { switch (app) {
case "link": case "link":
[, , ship, name] = path.split("/"); return props.graphKeys.has(graphKey);
return props.graphKeys.has(path);
case "publish": case "publish":
[, ship, name] = path.split("/"); [, ship, name] = path.split("/");
return !!props.notebooks[ship]?.[name]; return !!props.notebooks[ship]?.[name];

View File

@ -31,7 +31,7 @@ export class Omnibox extends Component {
const { pathname } = this.props.location; const { pathname } = this.props.location;
const selectedGroup = pathname.startsWith('/~landscape/ship/') ? '/' + pathname.split('/').slice(2,5).join('/') : null; const selectedGroup = pathname.startsWith('/~landscape/ship/') ? '/' + pathname.split('/').slice(2,5).join('/') : null;
this.setState({ index: index(this.props.associations, this.props.apps.tiles, selectedGroup) }); this.setState({ index: index(this.props.associations, this.props.apps.tiles, selectedGroup, this.props.groups) });
} }
if (prevProps && (prevProps.apps !== this.props.apps) && (this.state.query === '')) { if (prevProps && (prevProps.apps !== this.props.apps) && (this.state.query === '')) {