Allow seeding a missing repo from a reference

Following a link to a repo we don't have only led to the explorer, but
the reason it's missing is usually that we haven't seeded it yet.
A deep link that can't be opened now says so instead of doing nothing.
This commit is contained in:
Rūdolfs Ošiņš
2026-10-06 11:16:14 +02:00
parent e010517b79
commit e793ed5f01
12 changed files with 367 additions and 95 deletions
+19 -3
View File
@@ -23,7 +23,14 @@ function target(link: string, local = true) {
}
describe("parseDeepLink", () => {
test.each([rid, `rad:///${repo}`, ` ${rid}\n`])("accepts %j", link => {
test.each([
rid,
`rad:///${repo}`,
` ${rid}\n`,
`rad:///${rid}`,
`rad://${rid}`,
`rad:${rid}`,
])("accepts %j", link => {
expect(parseDeepLink(link)).toEqual({ type: "uri", uri: { repo } });
});
@@ -59,13 +66,22 @@ describe("deepLinkTarget", () => {
expect(target(link)).toEqual({ type: "route", route });
});
test("opens the explorer when the repo is not here", () => {
test("offers to seed a repo that is not here", () => {
expect(target(`${rid}/cob/xyz.radicle.issue/${oid}`, false)).toEqual({
type: "external",
type: "missing",
rid,
url: `${explorer}/issues/${oid}`,
});
});
test("offers to seed a repo that is not here when nothing has a page", () => {
expect(target(`${rid}/tree/${oid}`, false)).toEqual({
type: "missing",
rid,
url: undefined,
});
});
test("opens the explorer for a page the app lacks", () => {
expect(target(`${rid}/cob/dev.radicle.artifact/${oid}`)).toEqual({
type: "external",