From 1a5430acede169861d0a6389ac6d0dab0daa26ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Tue, 27 Dec 2022 15:03:36 +0100 Subject: [PATCH] Rename URN -> ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: xphoniex Signed-off-by: Rūdolfs Ošiņš --- scripts/create-seed-fixture | 4 +- src/App/Header/Search.svelte | 6 +- src/App/Header/SearchResults.svelte | 10 +-- src/components/Authorship.svelte | 4 +- src/components/Comment.svelte | 4 +- .../{RadicleUrn.svelte => RadicleId.svelte} | 14 ++-- src/config.json | 24 +++---- src/lib/cobs.ts | 4 +- src/lib/config.ts | 2 +- src/lib/issue.ts | 12 ++-- src/lib/patch.ts | 16 ++--- src/lib/project.ts | 67 +++++++++++-------- src/lib/router.ts | 52 +++++++------- src/lib/router/definitions.ts | 2 +- src/lib/seed.ts | 6 +- src/lib/utils.ts | 8 +-- src/views/home/Index.svelte | 4 +- src/views/profiles/Profile.svelte | 4 +- src/views/projects/CloneButton.svelte | 6 +- src/views/projects/Header.svelte | 6 +- src/views/projects/History.svelte | 2 +- src/views/projects/Patch/PatchTimeline.svelte | 2 +- src/views/projects/ProjectMeta.svelte | 8 +-- src/views/projects/View.svelte | 20 +++--- src/views/projects/Widget.svelte | 8 +-- src/views/registrations/View.svelte | 2 +- src/views/seeds/View/Projects.svelte | 2 +- tests/e2e/clipboard.spec.ts | 4 +- tests/e2e/project.spec.ts | 4 +- tests/e2e/seed.spec.ts | 2 +- tests/support/fixtures.ts | 2 +- tests/unit/router.test.ts | 4 +- tests/unit/utils.test.ts | 8 +-- 33 files changed, 162 insertions(+), 161 deletions(-) rename src/components/{RadicleUrn.svelte => RadicleId.svelte} (81%) diff --git a/scripts/create-seed-fixture b/scripts/create-seed-fixture index 9eaf345f1..15c58a224 100755 --- a/scripts/create-seed-fixture +++ b/scripts/create-seed-fixture @@ -69,7 +69,7 @@ RAD_HOME=$ALICE_RAD_HOME rad init --name "source-browsing" --description "Git re sleep 10 RAD_HOME=$ALICE_RAD_HOME rad push --seed 0.0.0.0:8778 --all --sync -PROJECT_URN=$(rad .) +PROJECT_ID=$(rad .) GIT_AUTHOR_NAME="Bob Belcher" @@ -80,7 +80,7 @@ GIT_COMMITTER_EMAIL="bob@radicle.xyz" RAD_HOME=$BOB_RAD_HOME rad auth --init --name bob --passphrase $PASSPHRASE cd $BOB_CHECKOUT -RAD_HOME=$BOB_RAD_HOME rad clone $PROJECT_URN --seed 0.0.0.0:8778 --no-confirm +RAD_HOME=$BOB_RAD_HOME rad clone $PROJECT_ID --seed 0.0.0.0:8778 --no-confirm cd $TEST_REPO_NAME echo "Updated readme" > README.md diff --git a/src/App/Header/Search.svelte b/src/App/Header/Search.svelte index 898cbc5f1..1e7158d46 100644 --- a/src/App/Header/Search.svelte +++ b/src/App/Header/Search.svelte @@ -32,11 +32,11 @@ } const projectOnSeeds = config.seeds.pinned.map(seed => ({ - nameOrUrn: query, + nameOrId: query, seed: seed.host, })); - // The query is a radicle project URN. + // The query is a radicle project ID. if (utils.isRadicleId(query)) { const projects = await Project.getMulti(projectOnSeeds); @@ -178,7 +178,7 @@ resource: "projects", params: { view: { resource: "tree" }, - urn: searchResult.id, + id: searchResult.id, peer: undefined, profile: undefined, seed: searchResult.seedHost, diff --git a/src/App/Header/SearchResults.svelte b/src/App/Header/SearchResults.svelte index 35b2ddda6..9173a4abf 100644 --- a/src/App/Header/SearchResults.svelte +++ b/src/App/Header/SearchResults.svelte @@ -1,6 +1,6 @@
-
+
🌱 - rad:git: - {parseRadicleId(urn)} + rad: + {parseRadicleId(id)}
diff --git a/src/config.json b/src/config.json index c1106882f..b79946961 100644 --- a/src/config.json +++ b/src/config.json @@ -15,62 +15,62 @@ "pinned": [ { "name": "radicle-cli", - "urn": "rad:git:hnrkmg77m8tfzj4gi4pa4mbhgysfgzwntjpao", + "id": "rad:git:hnrkmg77m8tfzj4gi4pa4mbhgysfgzwntjpao", "seed": "clients.radicle.xyz" }, { "name": "radicle-interface", - "urn": "rad:git:hnrkjajuucc6zp5eknt3s9xykqsrus44cjimy", + "id": "rad:git:hnrkjajuucc6zp5eknt3s9xykqsrus44cjimy", "seed": "clients.radicle.xyz" }, { "name": "radicle-client-services", - "urn": "rad:git:hnrkk9c4zt9thuxhwi1ukxqcrs5tmhbtcsony", + "id": "rad:git:hnrkk9c4zt9thuxhwi1ukxqcrs5tmhbtcsony", "seed": "clients.radicle.xyz" }, { "name": "solmate", - "urn": "rad:git:hnrkbgczcfh9ycjtdfynmqyg478bqrso1hnty", + "id": "rad:git:hnrkbgczcfh9ycjtdfynmqyg478bqrso1hnty", "seed": "willow.radicle.garden" }, { "name": "openzeppelin-contracts", - "urn": "rad:git:hnrkbx9xzjg8tf9hj9uh5qdxwuyjddsxyaw6o", + "id": "rad:git:hnrkbx9xzjg8tf9hj9uh5qdxwuyjddsxyaw6o", "seed": "willow.radicle.garden" }, { "name": "haskell-language-server", - "urn": "rad:git:hnrkf1jaje1e93rua64zgphg7zb14qo9zexgy", + "id": "rad:git:hnrkf1jaje1e93rua64zgphg7zb14qo9zexgy", "seed": "pine.radicle.garden" }, { "name": "rx", - "urn": "rad:git:hnrk8aoks6w3tdbcwt9dqnor9aqy8tjha3k5o", + "id": "rad:git:hnrk8aoks6w3tdbcwt9dqnor9aqy8tjha3k5o", "seed": "maple.radicle.garden" }, { "name": "astrolabe", - "urn": "rad:git:hnrkrwewct7pb1biwmf59qa3rzod8mauundzy", + "id": "rad:git:hnrkrwewct7pb1biwmf59qa3rzod8mauundzy", "seed": "willow.radicle.garden" }, { "name": "svelte-dappkit", - "urn": "rad:git:hnrkgcm1e588ewy7iiq4abrrgtf5ioq577eno", + "id": "rad:git:hnrkgcm1e588ewy7iiq4abrrgtf5ioq577eno", "seed": "maple.radicle.garden" }, { "name": "tmyxer", - "urn": "rad:git:hnrkp5jgfxwxrffjsp148fyzdc457pa9ja38y", + "id": "rad:git:hnrkp5jgfxwxrffjsp148fyzdc457pa9ja38y", "seed": "pine.radicle.garden" }, { "name": "pax", - "urn": "rad:git:hnrkffdfm4et8c4g1ebpbkjj46nagyiepmu5o", + "id": "rad:git:hnrkffdfm4et8c4g1ebpbkjj46nagyiepmu5o", "seed": "pine.radicle.garden" }, { "name": "hexade", - "urn": "rad:git:hnrkxj511yr48oo3usrt4jzfoucj88zphpryo", + "id": "rad:git:hnrkxj511yr48oo3usrt4jzfoucj88zphpryo", "seed": "pine.radicle.garden" } ] diff --git a/src/lib/cobs.ts b/src/lib/cobs.ts index b9120a13d..f0d298adf 100644 --- a/src/lib/cobs.ts +++ b/src/lib/cobs.ts @@ -2,7 +2,7 @@ import type { PeerId } from "@app/lib/project"; export interface Author { peer: PeerId; - urn: string; + id: string; profile: { name: string; ens: { @@ -12,7 +12,7 @@ export interface Author { } export interface PeerIdentity { - urn: string; + id: string; name: string; ens: { name: string; diff --git a/src/lib/config.ts b/src/lib/config.ts index 7500c60a6..cfa054897 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -9,7 +9,7 @@ export interface Config { projects: { pinned: { name: string; - urn: string; + id: string; seed: string; }[]; }; diff --git a/src/lib/issue.ts b/src/lib/issue.ts index 243ed9e36..962f69578 100644 --- a/src/lib/issue.ts +++ b/src/lib/issue.ts @@ -81,21 +81,17 @@ export class Issue { }, 0); } - static async getIssues(urn: string, host: Host): Promise { + static async getIssues(id: string, host: Host): Promise { const response: IIssue[] = await new Request( - `projects/${urn}/issues`, + `projects/${id}/issues`, host, ).get(); return response.map(issue => new Issue(issue)); } - static async getIssue( - urn: string, - issue: string, - host: Host, - ): Promise { + static async getIssue(id: string, issue: string, host: Host): Promise { const response: IIssue = await new Request( - `projects/${urn}/issues/${issue}`, + `projects/${id}/issues/${issue}`, host, ).get(); return new Issue(response); diff --git a/src/lib/patch.ts b/src/lib/patch.ts index 93cc70113..cd775154f 100644 --- a/src/lib/patch.ts +++ b/src/lib/patch.ts @@ -3,7 +3,7 @@ import type { Comment, Thread } from "@app/lib/issue"; import type { Commit, DiffStats } from "@app/lib/commit"; import type { Diff } from "@app/lib/diff"; import type { Host } from "@app/lib/api"; -import type { PeerId, Urn } from "@app/lib/project"; +import type { PeerId, Id } from "@app/lib/project"; import { Request } from "@app/lib/api"; @@ -30,7 +30,7 @@ export interface Revision { oid: string; comment: Comment; discussion: Thread[]; - reviews: Record; + reviews: Record; merges: Merge[]; changeset: { diff: Diff; @@ -142,21 +142,17 @@ export class Patch implements IPatch { return timeline.sort((a, b) => a.timestamp - b.timestamp); } - static async getPatches(urn: string, host: Host): Promise { + static async getPatches(id: string, host: Host): Promise { const response: IPatch[] = await new Request( - `projects/${urn}/patches`, + `projects/${id}/patches`, host, ).get(); return response.map(patch => new Patch(patch)); } - static async getPatch( - urn: string, - patch: string, - host: Host, - ): Promise { + static async getPatch(id: string, patch: string, host: Host): Promise { const response: IPatch = await new Request( - `projects/${urn}/patches/${patch}`, + `projects/${id}/patches/${patch}`, host, ).get(); return new Patch(response); diff --git a/src/lib/project.ts b/src/lib/project.ts index c0cecb74b..d39217dee 100644 --- a/src/lib/project.ts +++ b/src/lib/project.ts @@ -6,7 +6,7 @@ import { Profile, ProfileType } from "@app/lib/profile"; import { Seed } from "@app/lib/seed"; import { isFulfilled, isOid, isRadicleId } from "@app/lib/utils"; -export type Urn = string; +export type Id = string; export type PeerId = string; export type Branches = { [key: string]: string }; export type MaybeBlob = Blob | undefined; @@ -15,7 +15,7 @@ export type MaybeTree = Tree | undefined; export type Delegate = | { type: "indirect"; - urn: Urn; + id: Id; ids: PeerId[]; } | { @@ -36,7 +36,7 @@ export enum ProjectContent { export interface ProjectInfo { head: string | null; - urn: string; + id: string; name: string; description: string; defaultBranch: string; @@ -139,7 +139,7 @@ export function parseRoute( } export class Project implements ProjectInfo { - urn: string; + id: string; head: string | null; name: string; description: string; @@ -155,14 +155,14 @@ export class Project implements ProjectInfo { issues?: number; constructor( - urn: string, + id: string, info: ProjectInfo, seed: Seed, peers: Peer[], branches: Branches, profile: Profile | null, ) { - this.urn = urn; + this.id = id; this.head = info.head; this.name = info.name; this.description = info.description; @@ -191,8 +191,11 @@ export class Project implements ProjectInfo { return { tree, commit }; } - static async getInfo(nameOrUrn: string, host: Host): Promise { - return await new Request(`projects/${nameOrUrn}`, host).get(); + static async getInfo(nameOrId: string, host: Host): Promise { + const result = await new Request(`projects/${nameOrId}`, host).get(); + result["id"] = result["urn"]; + delete result["urn"]; + return result; } static async getProjects( @@ -206,7 +209,13 @@ export class Project implements ProjectInfo { "per-page": opts?.perPage, page: opts?.page, }; - return new Request("projects", host).get(params); + const results = await new Request("projects", host).get(params); + results.forEach((result: { [x: string]: any }) => { + result["id"] = result["urn"]; + delete result["urn"]; + }); + + return results; } static async getDelegateProjects( @@ -225,19 +234,19 @@ export class Project implements ProjectInfo { } static async getRemote( - urn: string, + id: string, peer: string, host: Host, ): Promise { - return new Request(`projects/${urn}/remotes/${peer}`, host).get(); + return new Request(`projects/${id}/remotes/${peer}`, host).get(); } - static async getRemotes(urn: string, host: Host): Promise { - return new Request(`projects/${urn}/remotes`, host).get(); + static async getRemotes(id: string, host: Host): Promise { + return new Request(`projects/${id}/remotes`, host).get(); } static async getCommits( - urn: string, + id: string, host: Host, opts?: { parent?: string | null; @@ -256,19 +265,19 @@ export class Project implements ProjectInfo { page: opts?.page, verified: opts?.verified, }; - return new Request(`projects/${urn}/commits`, host).get(params); + return new Request(`projects/${id}/commits`, host).get(params); } static async getActivity( - urn: string, + id: string, host: Host, ): Promise<{ activity: number[] }> { - return new Request(`projects/${urn}/activity`, host).get(); + return new Request(`projects/${id}/activity`, host).get(); } async getCommit(commit: string): Promise { return new Request( - `projects/${this.urn}/commits/${commit}`, + `projects/${this.id}/commits/${commit}`, this.seed.api, ).get(); } @@ -276,21 +285,21 @@ export class Project implements ProjectInfo { async getTree(commit: string, path: string): Promise { if (path === "/") path = ""; return new Request( - `projects/${this.urn}/tree/${commit}/${path}`, + `projects/${this.id}/tree/${commit}/${path}`, this.seed.api, ).get(); } async getBlob(commit: string, path: string): Promise { return new Request( - `projects/${this.urn}/blob/${commit}/${path}`, + `projects/${this.id}/blob/${commit}/${path}`, this.seed.api, ).get(); } async getReadme(commit: string): Promise { return new Request( - `projects/${this.urn}/readme/${commit}`, + `projects/${this.id}/readme/${commit}`, this.seed.api, ).get(); } @@ -324,13 +333,13 @@ export class Project implements ProjectInfo { } const info = await Project.getInfo(id, seed.api); - const urn = isRadicleId(id) ? id : info.urn; + id = isRadicleId(id) ? id : info.id; - // Older versions of http-api don't include the URN. - if (!info.urn) info.urn = urn; + // Older versions of http-api don't include the ID. + if (!info.id) info.id = id; const peers: Peer[] = info.delegates - ? await Project.getRemotes(urn, seed.api) + ? await Project.getRemotes(id, seed.api) : []; let remote: Remote = { @@ -339,24 +348,24 @@ export class Project implements ProjectInfo { if (peer) { try { - remote = await Project.getRemote(urn, peer, seed.api); + remote = await Project.getRemote(id, peer, seed.api); } catch { remote.heads = {}; } } - return new Project(urn, info, seed, peers, remote.heads, profile); + return new Project(id, info, seed, peers, remote.heads, profile); } static async getMulti( - projs: { nameOrUrn: Urn; seed: string }[], + projs: { nameOrId: Id; seed: string }[], ): Promise<{ info: ProjectInfo; seed: Host }[]> { const promises = []; for (const proj of projs) { const seed = { host: proj.seed, port: null }; promises.push( - Project.getInfo(proj.nameOrUrn, seed).then(info => { + Project.getInfo(proj.nameOrId, seed).then(info => { return { info, seed }; }), ); diff --git a/src/lib/router.ts b/src/lib/router.ts index 1bf10deee..ef9ebf4e5 100644 --- a/src/lib/router.ts +++ b/src/lib/router.ts @@ -206,21 +206,21 @@ function pathToRoute(path: string): Route | null { case "seeds": { const host = segments.shift(); if (host) { - const urn = segments.shift(); - if (urn) { + const id = segments.shift(); + if (id) { if (segments.length === 0) { return { resource: "projects", params: { view: { resource: "tree" }, - urn, + id, peer: undefined, profile: undefined, seed: host, }, }; } - const params = resolveProjectRoute(url, urn, segments); + const params = resolveProjectRoute(url, id, segments); if (params) { return { resource: "projects", @@ -228,7 +228,7 @@ function pathToRoute(path: string): Route | null { ...params, search: url.search, seed: host, - urn, + id, }, }; } @@ -242,27 +242,27 @@ function pathToRoute(path: string): Route | null { return { resource: "home" }; default: { if (resource) { - const urn = segments.shift(); - if (urn) { + const id = segments.shift(); + if (id) { if (segments.length === 0) { return { resource: "projects", params: { view: { resource: "tree" }, - urn, + id, peer: undefined, profile: resource, seed: undefined, }, }; } else { - const params = resolveProjectRoute(url, urn, segments); + const params = resolveProjectRoute(url, id, segments); if (params) { return { resource: "projects", params: { ...params, - urn, + id, search: url.search, profile: resource, }, @@ -339,21 +339,21 @@ export function routeToPath(route: Route) { } if (route.params.view.resource === "tree") { - return `${hostPrefix}/${route.params.urn}${peer}/tree${suffix}`; + return `${hostPrefix}/${route.params.id}${peer}/tree${suffix}`; } else if (route.params.view.resource === "commits") { - return `${hostPrefix}/${route.params.urn}${peer}/commits${suffix}`; + return `${hostPrefix}/${route.params.id}${peer}/commits${suffix}`; } else if (route.params.view.resource === "history") { - return `${hostPrefix}/${route.params.urn}${peer}/history${suffix}`; + return `${hostPrefix}/${route.params.id}${peer}/history${suffix}`; } else if (route.params.view.resource === "patches") { - return `${hostPrefix}/${route.params.urn}${peer}/patches${suffix}`; + return `${hostPrefix}/${route.params.id}${peer}/patches${suffix}`; } else if (route.params.view.resource === "patch") { - return `${hostPrefix}/${route.params.urn}${peer}/patches/${route.params.view.params.patch}`; + return `${hostPrefix}/${route.params.id}${peer}/patches/${route.params.view.params.patch}`; } else if (route.params.view.resource === "issues") { - return `${hostPrefix}/${route.params.urn}${peer}/issues${suffix}`; + return `${hostPrefix}/${route.params.id}${peer}/issues${suffix}`; } else if (route.params.view.resource === "issue") { - return `${hostPrefix}/${route.params.urn}${peer}/issues/${route.params.view.params.issue}`; + return `${hostPrefix}/${route.params.id}${peer}/issues/${route.params.view.params.issue}`; } else { - return `${hostPrefix}/${route.params.urn}${peer}${content}`; + return `${hostPrefix}/${route.params.id}${peer}${content}`; } } else if (route.resource === "registrations") { if (route.params.view.resource === "validateName") { @@ -380,7 +380,7 @@ export function routeToPath(route: Route) { function resolveProjectRoute( url: URL, - urn: string, + id: string, segments: string[], ): ProjectsParams | null { let content = segments.shift(); @@ -395,7 +395,7 @@ function resolveProjectRoute( const hash = url.href.match(/#{1}[^#.]+$/)?.pop(); return { view: { resource: "tree" }, - urn, + id, peer, path: undefined, revision: undefined, @@ -406,7 +406,7 @@ function resolveProjectRoute( } else if (content === "history") { return { view: { resource: "history" }, - urn, + id, peer, path: undefined, revision: undefined, @@ -415,7 +415,7 @@ function resolveProjectRoute( } else if (content === "commits") { return { view: { resource: "commits" }, - urn, + id, peer, path: undefined, revision: undefined, @@ -426,7 +426,7 @@ function resolveProjectRoute( if (patch) { return { view: { resource: "patch", params: { patch } }, - urn, + id, peer, path: undefined, revision: undefined, @@ -434,7 +434,7 @@ function resolveProjectRoute( } else { return { view: { resource: "patches" }, - urn, + id, peer, path: undefined, revision: undefined, @@ -445,7 +445,7 @@ function resolveProjectRoute( if (issue) { return { view: { resource: "issue", params: { issue } }, - urn, + id, peer, path: undefined, revision: undefined, @@ -453,7 +453,7 @@ function resolveProjectRoute( } else { return { view: { resource: "issues" }, - urn, + id, peer, path: undefined, revision: undefined, diff --git a/src/lib/router/definitions.ts b/src/lib/router/definitions.ts index b230a65da..ea20a6a71 100644 --- a/src/lib/router/definitions.ts +++ b/src/lib/router/definitions.ts @@ -11,7 +11,7 @@ export type Route = | { resource: "seeds"; params: { host: string } }; export interface ProjectsParams { - urn: string; + id: string; view: | { resource: "tree" } | { resource: "commits" } diff --git a/src/lib/seed.ts b/src/lib/seed.ts index 35d442219..f104a7125 100644 --- a/src/lib/seed.ts +++ b/src/lib/seed.ts @@ -112,8 +112,8 @@ export class Seed { return Seed.getPeer(this.api); } - async getProject(urn: string): Promise { - return proj.Project.getInfo(urn, this.api); + async getProject(id: string): Promise { + return proj.Project.getInfo(id, this.api); } async getProjects(perPage: number, id?: string): Promise { @@ -123,7 +123,7 @@ export class Seed { return result.map((project: proj.ProjectInfo) => ({ ...project, - id: project.urn, + id: project.id, })); } diff --git a/src/lib/utils.ts b/src/lib/utils.ts index a529a989f..fbdf2f09c 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -102,7 +102,7 @@ export function formatSeedId(id: string): string { return id.substring(0, 6) + "…" + id.substring(id.length - 6, id.length); } -export function formatRadicleUrn(id: string): string { +export function formatRadicleId(id: string): string { assert(isRadicleId(id)); return id.substring(0, 14) + "…" + id.substring(id.length - 6, id.length); @@ -293,9 +293,9 @@ export function formatName(input: string, wallet: Wallet): string { return parseEnsLabel(input, wallet); } -// Parse a Radicle Id (URN). -export function parseRadicleId(urn: string): string { - return urn.replace(/^rad:[a-z]+:/, ""); +// Parse a Radicle Id. +export function parseRadicleId(id: string): string { + return id.replace(/^rad:[a-z]+:/, ""); } // Get amount of days passed between two dates without including the end date diff --git a/src/views/home/Index.svelte b/src/views/home/Index.svelte index 3f2d7157d..63834f350 100644 --- a/src/views/home/Index.svelte +++ b/src/views/home/Index.svelte @@ -20,7 +20,7 @@ config.projects.pinned.length > 0 ? Project.getMulti( config.projects.pinned.map(project => ({ - nameOrUrn: project.urn, + nameOrId: project.id, seed: project.seed, })), ) @@ -31,7 +31,7 @@ resource: "projects", params: { view: { resource: "tree" }, - urn: project.urn, + id: project.id, peer: undefined, seed: seed.host, profile: undefined, diff --git a/src/views/profiles/Profile.svelte b/src/views/profiles/Profile.svelte index 32330d12a..fc579d338 100644 --- a/src/views/profiles/Profile.svelte +++ b/src/views/profiles/Profile.svelte @@ -15,7 +15,7 @@ import Loading from "@app/components/Loading.svelte"; import NotFound from "@app/components/NotFound.svelte"; import Projects from "@app/views/seeds/View/Projects.svelte"; - import RadicleUrn from "@app/components/RadicleUrn.svelte"; + import RadicleId from "@app/components/RadicleId.svelte"; import SeedAddress from "@app/components/SeedAddress.svelte"; import SetName from "./SetName.svelte"; import { MissingReverseRecord, NotFoundError } from "@app/lib/error"; @@ -182,7 +182,7 @@ {#if profile.id}
ID
- + {/if} {#if profile.seed && profile.seed.valid} diff --git a/src/views/projects/CloneButton.svelte b/src/views/projects/CloneButton.svelte index c8ccfeb43..b82fb570f 100644 --- a/src/views/projects/CloneButton.svelte +++ b/src/views/projects/CloneButton.svelte @@ -5,10 +5,10 @@ import { closeFocused } from "@app/components/Floating.svelte"; export let seedHost: string; - export let urn: string; + export let id: string; - $: radCloneUrl = `rad clone rad://${seedHost}/${utils.parseRadicleId(urn)}`; - $: gitCloneUrl = `https://${seedHost}/${utils.parseRadicleId(urn)}.git`; + $: radCloneUrl = `rad clone rad://${seedHost}/${utils.parseRadicleId(id)}`; + $: gitCloneUrl = `https://${seedHost}/${utils.parseRadicleId(id)}.git`;
- {#await getProject(urn, peer, profile, seed)} + {#await getProject(id, peer, profile, seed)}
@@ -115,7 +115,7 @@ {#if activeRoute.params.view.resource === "tree"} {:else if activeRoute.params.view.resource === "history"} - {#await proj.Project.getCommits( project.urn, project.seed.api, { parent: commit, verified: true }, )} + {#await proj.Project.getCommits( project.id, project.seed.api, { parent: commit, verified: true }, )} {:then history} @@ -135,7 +135,7 @@
{/await} {:else if activeRoute.params.view.resource === "issues"} - {#await issue.Issue.getIssues(project.urn, project.seed.api)} + {#await issue.Issue.getIssues(project.id, project.seed.api)} {:then issues} @@ -145,7 +145,7 @@
{/await} {:else if activeRoute.params.view.resource === "issue"} - {#await issue.Issue.getIssue(project.urn, activeRoute.params.view.params.issue, project.seed.api)} + {#await issue.Issue.getIssue(project.id, activeRoute.params.view.params.issue, project.seed.api)} {:then issue} @@ -155,7 +155,7 @@ {/await} {:else if activeRoute.params.view.resource === "patches"} - {#await patch.Patch.getPatches(project.urn, project.seed.api)} + {#await patch.Patch.getPatches(project.id, project.seed.api)} {:then patches} @@ -165,7 +165,7 @@ {/await} {:else if activeRoute.params.view.resource === "patch"} - {#await patch.Patch.getPatch(project.urn, activeRoute.params.view.params.patch, project.seed.api)} + {#await patch.Patch.getPatch(project.id, activeRoute.params.view.params.patch, project.seed.api)} {:then patch} @@ -202,6 +202,6 @@ {/await} {:catch} - + {/await} diff --git a/src/views/projects/Widget.svelte b/src/views/projects/Widget.svelte index 816d566dd..f4f722017 100644 --- a/src/views/projects/Widget.svelte +++ b/src/views/projects/Widget.svelte @@ -12,7 +12,7 @@ export let compact = false; const loadCommits = async () => { - const commits = await Project.getActivity(project.urn, seed.api); + const commits = await Project.getActivity(project.id, seed.api); return groupCommitsByWeek(commits.activity); }; @@ -92,14 +92,14 @@ display: flex; justify-content: space-between; } - article .id .urn { + article .id .rid { visibility: hidden; color: var(--color-foreground-5); font-weight: var(--font-weight-normal); font-family: var(--font-family-monospace); font-size: var(--font-size-tiny); } - article:hover .id .urn { + article:hover .id .rid { visibility: visible; } @media (max-width: 720px) { @@ -147,7 +147,7 @@ {#if !compact}
- {project.urn} + {project.id}
{#await loadCommits() then points}
diff --git a/src/views/registrations/View.svelte b/src/views/registrations/View.svelte index 2e4d9f633..8142659ce 100644 --- a/src/views/registrations/View.svelte +++ b/src/views/registrations/View.svelte @@ -124,7 +124,7 @@ name: "id", label: "Radicle", validate: "identity", - placeholder: "Radicle URN, eg. rad:git:hnrkqdpm9ub19oc8d…", + placeholder: "Radicle ID, eg. rad:git:hnrkqdpm9ub19oc8d…", description: "The local radicle identity associated with this name.", value: r.profile.id ?? "", editable: true, diff --git a/src/views/seeds/View/Projects.svelte b/src/views/seeds/View/Projects.svelte index 45bbb70e0..bd1ba5b4a 100644 --- a/src/views/seeds/View/Projects.svelte +++ b/src/views/seeds/View/Projects.svelte @@ -40,7 +40,7 @@ resource: "projects", params: { view: { resource: "tree" }, - urn: project.urn, + id: project.id, seed: seed.api.port ? `${seed.api.host}:${seed.api.port}` : seed.api.host, diff --git a/tests/e2e/clipboard.spec.ts b/tests/e2e/clipboard.spec.ts index a5682e694..cec35cf85 100644 --- a/tests/e2e/clipboard.spec.ts +++ b/tests/e2e/clipboard.spec.ts @@ -27,9 +27,9 @@ test("copy to clipboard", async ({ page, browserName, context }) => { // Reset system clipboard to a known state. await page.evaluate("navigator.clipboard.writeText('')"); - // Project URN. + // Project ID. { - await page.locator(".urn > .clipboard").click(); + await page.locator(".id > .clipboard").click(); const clipboardContent = await page.evaluate( "navigator.clipboard.readText()", ); diff --git a/tests/e2e/project.spec.ts b/tests/e2e/project.spec.ts index 25daf14fe..0356fbc56 100644 --- a/tests/e2e/project.spec.ts +++ b/tests/e2e/project.spec.ts @@ -20,7 +20,7 @@ test("navigate to project", async ({ page }) => { // Header. { const name = page.locator("text=source-browsing"); - const urn = page.locator( + const id = page.locator( "text=rad:git:hnrkdi8be7n4hhqoz9rpzrgd68u9dr3zsxgmy", ); const description = page.locator( @@ -28,7 +28,7 @@ test("navigate to project", async ({ page }) => { ); await expect(name).toBeVisible(); - await expect(urn).toBeVisible(); + await expect(id).toBeVisible(); await expect(description).toBeVisible(); } diff --git a/tests/e2e/seed.spec.ts b/tests/e2e/seed.spec.ts index cdfe44de4..78a8a0e83 100644 --- a/tests/e2e/seed.spec.ts +++ b/tests/e2e/seed.spec.ts @@ -33,7 +33,7 @@ test("seed projects", async ({ page }) => { ).toBeVisible(); } - // Show project URN on hover. + // Show project ID on hover. { await expect( project.locator("text=rad:git:hnrkdi8be7n4hhqoz9rpzrgd68u9dr3zsxgmy"), diff --git a/tests/support/fixtures.ts b/tests/support/fixtures.ts index fc08c12c4..07fcefee0 100644 --- a/tests/support/fixtures.ts +++ b/tests/support/fixtures.ts @@ -173,7 +173,7 @@ export function appConfigWithFixture() { pinned: [ { name: "source-browsing", - urn: "rad:git:hnrkdi8be7n4hhqoz9rpzrgd68u9dr3zsxgmy", + id: "rad:git:hnrkdi8be7n4hhqoz9rpzrgd68u9dr3zsxgmy", seed: "0.0.0.0", }, ], diff --git a/tests/unit/router.test.ts b/tests/unit/router.test.ts index d5629f51c..8f4acf3f3 100644 --- a/tests/unit/router.test.ts +++ b/tests/unit/router.test.ts @@ -101,7 +101,7 @@ describe("routeToPath", () => { params: { view: { resource: "tree" }, seed: "willow.radicle.garden", - urn: "rad:git:hnrkmg77m8tfzj4gi4pa4mbhgysfgzwntjpao", + id: "rad:git:hnrkmg77m8tfzj4gi4pa4mbhgysfgzwntjpao", }, }, output: @@ -228,7 +228,7 @@ describe("pathToRoute", () => { seed: "willow.radicle.garden", profile: undefined, peer: undefined, - urn: "rad:git:hnrkmg77m8tfzj4gi4pa4mbhgysfgzwntjpao", + id: "rad:git:hnrkmg77m8tfzj4gi4pa4mbhgysfgzwntjpao", }, }, description: "Seed Project Route", diff --git a/tests/unit/utils.test.ts b/tests/unit/utils.test.ts index 96527f9ac..65215fee5 100644 --- a/tests/unit/utils.test.ts +++ b/tests/unit/utils.test.ts @@ -36,15 +36,15 @@ describe("Format functions", () => { expect(utils.formatSeedId(id)).toEqual(expected); }); - test("formatRadicleUrn", () => { + test("formatRadicleId", () => { expect( - utils.formatRadicleUrn("rad:git:hnrkemobagsicpf9sr95o3g551otspcd84c9o"), + utils.formatRadicleId("rad:git:hnrkemobagsicpf9sr95o3g551otspcd84c9o"), ).toEqual("rad:git:hnrkem…d84c9o"); }); - test("formatRadicleUrn throw when wrong URN", () => { + test("formatRadicleId throw when wrong ID", () => { expect(() => - utils.formatRadicleUrn("hnrkemobagsicpf9sr95o3g551otspcd84c9o"), + utils.formatRadicleId("hnrkemobagsicpf9sr95o3g551otspcd84c9o"), ).toThrow(); });