Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions apps/server/src/issue/IssueService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,24 @@ describe("IssueService", () => {
yield* enterprise.resolveUrl("https://code.acme.test/acme/web/issues/7"),
).toMatchObject({ projectId: "ghes", host: "code.acme.test", key: "7", writable: true });

// The same holds for a self-hosted Forgejo.
const forgejo = yield* makeService({
projects: [
project({
id: "forge",
repository: "acme/web",
provider: "forgejo",
host: "code.acme.test",
}),
],
trackers: [fakeTracker({ kind: IssueTrackerKind.make("forgejo") })],
});
expect(yield* forgejo.resolveUrl("https://code.acme.test/acme/web/issues/7")).toMatchObject({
projectId: "forge",
host: "code.acme.test",
key: "7",
});

// A fork lists its upstream's issues and its own, counted once, and may write to both.
const fork = project({ id: "fork", repository: "acme/web" });
const forked = yield* makeService({
Expand Down
6 changes: 4 additions & 2 deletions packages/source-control-forgejo/src/shared/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ export const definition = defineSourceControl({
const link = parseChangeRequestPath(url, CHANGE_REQUEST_PATH);
return link === null ? null : { ...link, authority: url.host.toLowerCase() };
},
// `/issues/` is too generic a path to believe from a host not named after Forgejo or Gitea.
parseIssueUrl: (url) => (isForgejoHost(url.hostname) ? parseIssuePath(url, ISSUE_PATH) : null),
// `/issues/` is too generic a path to believe from a host not named after Forgejo or Gitea,
// unless a Forgejo project on that host vouches for it.
parseIssueUrl: (url, known) =>
known || isForgejoHost(url.hostname) ? parseIssuePath(url, ISSUE_PATH) : null,
changeRequestUrlFromReferenceAutolink: () => null,
commitUrl: (input) => buildCommitUrl(input, "commit"),
parseCommitUrl: (url) => parseCommitPath(url, COMMIT_PATH),
Expand Down
Loading