Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Jump to org in resolver
Alexis Sellier committed 4 years ago
commit 8e598eeef31ee89d61cc3bcac4cef9ba2e2f8d4a
parent 86df6db88e65123ed06579573ea087dc0fc9c9b9
2 files changed +14 -2
modified src/base/resolver/Query.svelte
@@ -11,7 +11,7 @@

  let error = false;

-
  onMount(() => {
+
  onMount(async () => {
    if (query) {
      if (ethers.utils.isAddress(query)) {
        // Go to org.
@@ -24,7 +24,14 @@
        if (label.includes(".")) {
          error = true;
        } else {
-
          navigate(`/registrations/${label}`, { replace: true });
+
          // Jump straight to org, if the ENS entry points to an org. Otherwise just go to the
+
          // registration.
+
          const address = await utils.resolveLabel(label, config);
+
          if (address && await utils.identifyAddress(address, config) === utils.AddressType.Org) {
+
            navigate(`/orgs/${address}`, { replace: true });
+
          } else {
+
            navigate(`/registrations/${label}`, { replace: true });
+
          }
        }
      }
    } else {
modified src/utils.ts
@@ -138,3 +138,8 @@ export async function identifyAddress(address: string, config: Config): Promise<
    }
    return AddressType.EOA;
}
+

+
// Resolve a label under the radicle domain.
+
export async function resolveLabel(label: string, config: Config): Promise<string | null> {
+
  return config.provider.resolveName(`${label}.${config.registrar.domain}`);
+
}