Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(web): type the share destination's organization id as an organisation id

Richie McIlroy305f5567b558
diff --git a/apps/web/__tests__/unit/share-dashboard-destination.test.ts b/apps/web/__tests__/unit/share-dashboard-destination.test.ts
index 0c7e37fbd..eab8db143 100644
--- a/apps/web/__tests__/unit/share-dashboard-destination.test.ts
+++ b/apps/web/__tests__/unit/share-dashboard-destination.test.ts
@@ -1,4 +1,4 @@
-import type { User, Video } from "@cap/web-domain";
+import type { Organisation, User, Video } from "@cap/web-domain";
import { beforeEach, describe, expect, it, vi } from "vitest";
type Column = { table: string; column: string };
@@ -256,7 +256,7 @@ describe("getShareDashboardDestination", () => {
const resolve = (
viewerId: User.UserId | null,
- videoOrganizationId = "org-active",
+ videoOrganizationId = "org-active" as Organisation.OrganisationId,
) =>
getShareDashboardDestination({
viewer: viewerId
@@ -328,7 +328,9 @@ describe("getShareDashboardDestination", () => {
it("checks the owner's membership before switching to the Cap's organization", async () => {
rowsFor = { organizationMembers: [{ id: "membership-1" }] };
- expect(await resolve(OWNER, "org-other")).toMatchObject({
+ expect(
+ await resolve(OWNER, "org-other" as Organisation.OrganisationId),
+ ).toMatchObject({
kind: "caps",
switchOrganizationId: "org-other",
});
@@ -342,7 +344,9 @@ describe("getShareDashboardDestination", () => {
});
it("does not switch when the owner has left the Cap's organization", async () => {
- expect(await resolve(OWNER, "org-other")).toMatchObject({
+ expect(
+ await resolve(OWNER, "org-other" as Organisation.OrganisationId),
+ ).toMatchObject({
kind: "caps",
switchOrganizationId: null,
});
diff --git a/apps/web/lib/share-dashboard-destination.ts b/apps/web/lib/share-dashboard-destination.ts
index 0cd9b53cc..5788866bc 100644
--- a/apps/web/lib/share-dashboard-destination.ts
+++ b/apps/web/lib/share-dashboard-destination.ts
@@ -9,7 +9,7 @@ import {
spaceVideos,
videos,
} from "@cap/database/schema";
-import type { User, Video } from "@cap/web-domain";
+import type { Organisation, User, Video } from "@cap/web-domain";
import { and, eq, isNull } from "drizzle-orm";
export type ShareDashboardDestination = {
@@ -112,7 +112,7 @@ export async function getShareDashboardDestination({
viewer: { id: User.UserId; activeOrganizationId: string | null } | null;
videoId: Video.VideoId;
ownerId: User.UserId;
- videoOrganizationId: string;
+ videoOrganizationId: Organisation.OrganisationId;
}): Promise<ShareDashboardDestination | null> {
if (!viewer) return null;