Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Update author resolving to new API response
Sebastian Martinez committed 3 years ago
commit 5d34f77bc3ead0eac4e772202f67f5ce4b44449d
parent 638fecfc790dda4c77cf666095db41726b9e3073
5 files changed +20 -12
modified src/base/projects/Issue.svelte
@@ -132,7 +132,7 @@
        </div>
      </div>
      <div class="text-small">
-
        {issue.author.name}
+
        {issue.author.identity.name}
        <span class="faded">opened on</span>
        <span class="date">
          {formatTimestamp(issue.timestamp)}
modified src/base/projects/Issue/IssueAuthorship.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
  import type { Config } from "@app/config";
  import type { Author } from "@app/issue";
-
  import { formatTimestamp } from "@app/utils";
+
  import { formatRadicleUrn, formatTimestamp } from "@app/utils";
  import Address from "@app/Address.svelte";
  import type { Profile } from "@app/profile";

@@ -35,9 +35,13 @@
<span class="authorship text-xsmall">
  {#if profile}
    <Address resolve address={profile.address} noBadge {noAvatar} compact small {config} {profile} />
+
  {:else if author.identity.name}
+
    <span class="highlight">
+
      {author.identity.name}
+
    </span>
  {:else}
    <span class="highlight">
-
      {author.name}
+
      {formatRadicleUrn(author.identity.urn)}
    </span>
  {/if}
  <span class="desktop caption">&nbsp;{caption}&nbsp;</span>
modified src/base/projects/Issue/IssueComment.svelte
@@ -18,8 +18,8 @@
  let profile: Profile | null = null;

  onMount(async () => {
-
    if (comment.author.ens?.name) {
-
      profile = await Profile.get(comment.author.ens.name, ProfileType.Minimal, config);
+
    if (comment.author.identity.ens?.name) {
+
      profile = await Profile.get(comment.author.identity.ens.name, ProfileType.Minimal, config);
    }
  });

@@ -67,7 +67,7 @@

<div class="comment">
  <div class="person">
-
    <Avatar source={profile?.avatar || comment.author.urn} title={profile?.name || comment.author.urn} />
+
    <Avatar source={profile?.avatar || comment.author.identity.urn} title={profile?.name || comment.author.identity.urn} />
  </div>
  <div class="card">
    <div class="card-header">
modified src/base/projects/Issue/IssueTeaser.svelte
@@ -13,8 +13,8 @@
  let profile: Profile | null = null;

  onMount(async () => {
-
    if (issue.author.ens?.name) {
-
      profile = await Profile.get(issue.author.ens.name, ProfileType.Minimal, config);
+
    if (issue.author.identity.ens?.name) {
+
      profile = await Profile.get(issue.author.identity.ens.name, ProfileType.Minimal, config);
    }
  });

modified src/issue.ts
@@ -1,4 +1,5 @@
import { type Host, Request } from '@app/api';
+
import type { PeerId } from '@app/project';

export interface IIssue {
  id: string;
@@ -26,10 +27,13 @@ export interface Comment {
}

export interface Author {
-
  urn: string;
-
  name?: string;
-
  ens?: {
-
    name: string;
+
  peer: PeerId;
+
  identity: {
+
    urn: string;
+
    name?: string;
+
    ens?: {
+
      name: string;
+
    };
  };
}