Update author resolving to new API response

http-api has been updated to return a new type of Author e.g.

```json
"author": {
  "peer": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
  "identity": {
    "urn": "rad:git:hnrk81wcokr48mkm544kh74kc9fqz84d3rfcy",
    "name": "sebastinez",
    "ens": {
      "name": "sebastinez.radicle.eth"
    }
  }
}
```

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2022-06-29 15:45:06 +02:00
parent 638fecfc79
commit 5d34f77bc3
5 changed files with 20 additions and 12 deletions
+1 -1
View File
@@ -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)}
@@ -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>
+3 -3
View File
@@ -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">
+2 -2
View File
@@ -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);
}
});
+8 -4
View File
@@ -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;
};
};
}