mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Implement org profile fallback
When an org doesn't have its own profile, but its owner does, we fallback on that profile. This allows for "user" orgs, where a user keeps his projects anchored under an org, but all profile information under the user.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import Modal from '@app/Modal.svelte';
|
||||
import Avatar from '@app/Avatar.svelte';
|
||||
import { Profile } from '@app/profile';
|
||||
import { Org } from '@app/base/orgs/Org';
|
||||
|
||||
import Browser from './Browser.svelte';
|
||||
|
||||
@@ -16,13 +16,11 @@
|
||||
export let path: string;
|
||||
|
||||
let projectRoot = proj.path({ urn, org, commit });
|
||||
let getProject = new Promise<string | undefined>(resolve => {
|
||||
let getProject = new Promise<string | null>(resolve => {
|
||||
if (org) {
|
||||
Profile.get(org, config).then((p: Profile) => {
|
||||
resolve(p.seed);
|
||||
});
|
||||
Org.getProfile(org, config).then(p => resolve(p?.seed || null));
|
||||
} else {
|
||||
resolve(undefined);
|
||||
resolve(null);
|
||||
}
|
||||
}).then(async (seed) => {
|
||||
const cfg = seed ? config.withSeed(seed) : config;
|
||||
|
||||
@@ -16,15 +16,13 @@
|
||||
export let project: proj.Project;
|
||||
export let config: Config;
|
||||
export let org: string | undefined;
|
||||
export let seed: string | undefined;
|
||||
|
||||
let state: State = { status: Status.Loading };
|
||||
let info: proj.Info | null = null;
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
const cfg = seed ? config.withSeed(seed) : config;
|
||||
const result = await proj.getInfo(project.id, cfg);
|
||||
const result = await proj.getInfo(project.id, config);
|
||||
state = { status: Status.Loaded };
|
||||
info = result;
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user