mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-01 01:30:46 +08:00
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:
@@ -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"> {caption} </span>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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
@@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user