Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Use org seed for projects in org view
Alexis Sellier committed 4 years ago
commit 19b900991831c2ec453640320cec1e9b4fe11239
parent 931b18f18c73d209e0c8f9db2b9079db4eb05bdd
4 files changed +18 -2
modified src/base/orgs/View.svelte
@@ -220,7 +220,7 @@
          {:then projects}
            {#each projects as project}
              <div class="project">
-
                <Project {project} org={org.address} {config} />
+
                <Project {project} org={org.address} {config} seed={profile.seed} />
              </div>
            {/each}
          {:catch err}
modified src/base/projects/Widget.svelte
@@ -16,13 +16,15 @@
  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 result = await proj.getInfo(project.id, config);
+
      const cfg = seed ? config.withSeed(seed) : config;
+
      const result = await proj.getInfo(project.id, cfg);
      state = { status: Status.Loaded };
      info = result;
    } catch (err) {
modified src/config.ts
@@ -72,6 +72,15 @@ export class Config {
      this.provider,
    );
  }
+

+
  // Return the config with an overwritten seed URL.
+
  withSeed(seed: string): Config {
+
    const cfg = {} as Config;
+
    Object.assign(cfg, this);
+
    cfg.seed.api = seed;
+

+
    return cfg;
+
  }
}

/// Gas limits for various transactions.
modified src/profile.ts
@@ -54,6 +54,11 @@ export class Profile {
    else return undefined;
  }

+
  // Using undefined as return type if nothing to be returned since it works better with <a href> links
+
  get seed(): string | undefined {
+
    return this.profile?.ens?.seed ?? undefined;
+
  }
+

  // Keeping this function private since the desired entrypoint is .get()
  private static async lookupAddress(address: string, config: Config): Promise<[IProfile, string]> {
    const profile: IProfile = { ens: null, idx: null };