Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix peer selector for new http-api
Alexis Sellier committed 4 years ago
commit 2bed0e4fd018aab050115b22d5d0d04021e4c3ca
parent 7a3958ab4a9159ccd1568e0bafbe32fdb31677af
5 files changed +13 -13
modified cypress/fixtures/projectRemotes.json
@@ -1,7 +1,7 @@
[
  {
    "id": "hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke",
-
    "name": "dabit3",
+
    "person": { "name": "dabit3" },
    "delegate": true
  }
]
modified src/base/projects/PeerSelector.spec.ts
@@ -7,7 +7,7 @@ const defaultProps = {
  peers: [
    {
      "id": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
-
      "name": "sebastinez",
+
      "person": { "name": "sebastinez" },
      "delegate": true
    }
  ],
@@ -73,12 +73,12 @@ describe('Events', () => {
        peers: [
          {
            "id": "hyy841u4phudmr8s5rg1jjwd1ct7x7438wmjwtsm464y8uyxyhyi6c",
-
            "name": "cloudhead",
+
            "person": { "name": "cloudhead" },
            "delegate": true
          },
          {
            "id": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
-
            "name": "sebastinez",
+
            "person": { "name": "sebastinez" },
            "delegate": true
          }
        ]
modified src/base/projects/PeerSelector.svelte
@@ -17,8 +17,8 @@
  onMount(() => {
    meta = peers.find(p => p.id === peer);
    items = peers.map(p => {
-
      if (! p.name) console.debug("Not able to resolve peer identity for: ", p.id);
-
      let key = p.name ? `<strong>${p.name}</strong> ${p.id}` : p.id;
+
      if (! p.person?.name) console.debug("Not able to resolve peer identity for: ", p.id);
+
      let key = p.person?.name ? `<strong>${p.person.name}</strong> ${p.id}` : p.id;

      return { key, value: p.id, badge: p.delegate ? "delegate" : null };
    });
@@ -72,7 +72,7 @@
      <Icon name="fork" width={15} height={15} />
      {#if meta}
        <span class="peer-id">
-
          {meta.name ?? formatSeedId(meta.id)}
+
          {meta.person?.name ?? formatSeedId(meta.id)}
        </span>
        {#if meta.delegate}
          <span class="badge primary">delegate</span>
modified src/commit.ts
@@ -1,4 +1,4 @@
-
import type { Stats } from "@app/project";
+
import type { Stats, Person } from "@app/project";
import type { Diff } from "@app/diff";
import { ApiError } from "@app/api";

@@ -33,10 +33,6 @@ export interface GroupedCommitsHistory {
  stats: Stats;
}

-
export interface Person {
-
  name: string;
-
}
-

export interface CommitContext {
  committer?: {
    peer: {
modified src/project.ts
@@ -86,9 +86,13 @@ export interface Remote {
  heads: Branches;
}

+
export interface Person {
+
  name: string;
+
}
+

export interface Peer {
  id: PeerId;
-
  name: string;
+
  person?: Person;
  delegate: boolean;
}