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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ export class Omnibox extends Component {
const { pathname } = this.props.location;
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 === '')) {