Skip to content

Commit 407d084

Browse files
refactor(mobile): reuse inbox transport
Generated-By: PostHog Code Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
1 parent f6c4188 commit 407d084

3 files changed

Lines changed: 2 additions & 50 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { selectReportRepository } from "@posthog/core/inbox/reportArtefacts";
1+
import { extractRepoSelectionRepository } from "@posthog/core/inbox/artefacts";
22
import { getPostHogApiClient } from "@/lib/posthogApiClient";
33

44
/** Resolve the repository associated with a signal report via its repo_selection artefact. */
@@ -7,5 +7,5 @@ export async function getReportRepository(
77
): Promise<string | null> {
88
const { results } =
99
await getPostHogApiClient().getSignalReportArtefacts(reportId);
10-
return selectReportRepository(results);
10+
return extractRepoSelectionRepository(results);
1111
}

packages/core/src/inbox/reportArtefacts.test.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/core/src/inbox/reportArtefacts.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,3 @@ export function selectPriorityExplanation(
8181
?.content.explanation || null
8282
);
8383
}
84-
85-
export function selectReportRepository(
86-
artefacts: ReportArtefact[],
87-
): string | null {
88-
const artefact = artefacts.find((item) => item.type === "repo_selection");
89-
if (!artefact) return null;
90-
91-
let content: unknown = artefact.content;
92-
if (typeof content === "string") {
93-
const serialized = content;
94-
try {
95-
content = JSON.parse(serialized);
96-
} catch {
97-
return serialized.toLowerCase();
98-
}
99-
}
100-
101-
if (typeof content !== "object" || content === null) return null;
102-
const record = content as Record<string, unknown>;
103-
const repository = record.repository ?? record.repo;
104-
return typeof repository === "string" ? repository.toLowerCase() : null;
105-
}

0 commit comments

Comments
 (0)