Skip to content
Draft
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
12 changes: 3 additions & 9 deletions packages/cloud/src/StaticSettingsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,24 @@ export class StaticSettingsService implements SettingsService {
}

/**
* Returns static user settings with roomoteControlEnabled and extensionBridgeEnabled as true
* Returns static user settings with task sync enabled
*/
public getUserSettings(): UserSettingsData | undefined {
return {
features: {
roomoteControlEnabled: true,
},
features: {},
settings: {
extensionBridgeEnabled: true,
taskSyncEnabled: true,
},
version: 1,
}
}

public getUserFeatures(): UserFeatures {
return {
roomoteControlEnabled: true,
}
return {}
}

public getUserSettingsConfig(): UserSettingsConfig {
return {
extensionBridgeEnabled: true,
taskSyncEnabled: true,
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/cloud/src/StaticTokenAuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class StaticTokenAuthService extends EventEmitter<AuthServiceEvents> impl
this.userInfo = {
id: payload?.r?.u || payload?.sub || undefined,
organizationId: payload?.r?.o || undefined,
extensionBridgeEnabled: true,
}
}

Expand Down
16 changes: 0 additions & 16 deletions packages/cloud/src/WebAuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,6 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
)?.email_address
}

let extensionBridgeEnabled = true

// Fetch organization info if user is in organization context
try {
const storedOrgId = this.getStoredOrganizationId()
Expand All @@ -641,8 +639,6 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
if (userMembership) {
this.setUserOrganizationInfo(userInfo, userMembership)

extensionBridgeEnabled = await this.isExtensionBridgeEnabledForOrganization(storedOrgId)

this.log("[auth] User in organization context:", {
id: userMembership.organization.id,
name: userMembership.organization.name,
Expand All @@ -662,10 +658,6 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
if (primaryOrgMembership) {
this.setUserOrganizationInfo(userInfo, primaryOrgMembership)

extensionBridgeEnabled = await this.isExtensionBridgeEnabledForOrganization(
primaryOrgMembership.organization.id,
)

this.log("[auth] Legacy credentials: Found organization membership:", {
id: primaryOrgMembership.organization.id,
name: primaryOrgMembership.organization.name,
Expand All @@ -680,9 +672,6 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
// Don't throw - organization info is optional
}

// Set the extension bridge enabled flag
userInfo.extensionBridgeEnabled = extensionBridgeEnabled

return userInfo
}

Expand Down Expand Up @@ -754,11 +743,6 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
}
}

private async isExtensionBridgeEnabledForOrganization(organizationId: string): Promise<boolean> {
const orgMetadata = await this.getOrganizationMetadata(organizationId)
return orgMetadata?.public_metadata?.extension_bridge_enabled === true
}
Comment on lines -757 to -760
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing isExtensionBridgeEnabledForOrganization leaves the private getOrganizationMetadata method (lines 721-744) with zero callers -- it's now dead code. Worth removing it in this PR to keep the cleanup complete.

Fix it with Roo Code or mention @roomote and request a fix.


private async clerkLogout(credentials: AuthCredentials): Promise<void> {
const formData = new URLSearchParams()
formData.append("_is_native", "1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,8 @@ describe("CloudSettingsService - Response Parsing", () => {
},
},
user: {
features: {
roomoteControlEnabled: true,
},
settings: {
extensionBridgeEnabled: true,
},
features: {},
settings: {},
version: 1,
},
}
Expand Down
19 changes: 4 additions & 15 deletions packages/cloud/src/__tests__/StaticTokenAuthService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ describe("StaticTokenAuthService", () => {
const userInfo = serviceWithJWT.getUserInfo()
expect(userInfo?.id).toBe("user_2xmBhejNeDTwanM8CgIOnMgVxzC")
expect(userInfo?.organizationId).toBe("org_123abc")
expect(userInfo?.extensionBridgeEnabled).toBe(true)
})

it("should parse job token without orgId (null orgId case)", () => {
Expand All @@ -98,7 +97,6 @@ describe("StaticTokenAuthService", () => {
const userInfo = serviceWithJWT.getUserInfo()
expect(userInfo?.id).toBe("user_2xmBhejNeDTwanM8CgIOnMgVxzC")
expect(userInfo?.organizationId).toBeUndefined()
expect(userInfo?.extensionBridgeEnabled).toBe(true)
})

it("should parse auth token and extract userId from r.u", () => {
Expand All @@ -107,7 +105,6 @@ describe("StaticTokenAuthService", () => {
const userInfo = serviceWithAuthToken.getUserInfo()
expect(userInfo?.id).toBe("user_123")
expect(userInfo?.organizationId).toBeUndefined()
expect(userInfo?.extensionBridgeEnabled).toBe(true)
})

it("should handle legacy JWT format with sub field", () => {
Expand All @@ -116,7 +113,6 @@ describe("StaticTokenAuthService", () => {
const userInfo = serviceWithLegacyJWT.getUserInfo()
expect(userInfo?.id).toBe("user_123")
expect(userInfo?.organizationId).toBeUndefined()
expect(userInfo?.extensionBridgeEnabled).toBe(true)
})

it("should handle invalid JWT gracefully", () => {
Expand All @@ -125,7 +121,6 @@ describe("StaticTokenAuthService", () => {
const userInfo = serviceWithInvalidJWT.getUserInfo()
expect(userInfo?.id).toBeUndefined()
expect(userInfo?.organizationId).toBeUndefined()
expect(userInfo?.extensionBridgeEnabled).toBe(true)

expect(mockLog).toHaveBeenCalledWith("[auth] Failed to parse JWT:", expect.any(Error))
})
Expand Down Expand Up @@ -183,9 +178,7 @@ describe("StaticTokenAuthService", () => {
authService.broadcast()

expect(spy).toHaveBeenCalledWith({
userInfo: expect.objectContaining({
extensionBridgeEnabled: true,
}),
userInfo: expect.objectContaining({}),
})
})

Expand All @@ -199,7 +192,6 @@ describe("StaticTokenAuthService", () => {

expect(spy).toHaveBeenCalledWith({
userInfo: {
extensionBridgeEnabled: true,
id: "user_2xmBhejNeDTwanM8CgIOnMgVxzC",
organizationId: "org_123abc",
},
Expand All @@ -220,10 +212,9 @@ describe("StaticTokenAuthService", () => {
})

describe("getUserInfo", () => {
it("should return object with extensionBridgeEnabled flag", () => {
it("should return user info object", () => {
const userInfo = authService.getUserInfo()
expect(userInfo).toHaveProperty("extensionBridgeEnabled")
expect(userInfo?.extensionBridgeEnabled).toBe(true)
expect(userInfo).toBeDefined()
})
})

Expand Down Expand Up @@ -305,9 +296,7 @@ describe("StaticTokenAuthService", () => {
})

expect(userInfoSpy).toHaveBeenCalledWith({
userInfo: expect.objectContaining({
extensionBridgeEnabled: true,
}),
userInfo: expect.objectContaining({}),
})
})
})
Expand Down
5 changes: 0 additions & 5 deletions packages/cloud/src/__tests__/WebAuthService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,6 @@ describe("WebAuthService", () => {
name: "John Doe",
email: "john@example.com",
picture: "https://example.com/avatar.jpg",
extensionBridgeEnabled: true,
},
})
})
Expand Down Expand Up @@ -801,7 +800,6 @@ describe("WebAuthService", () => {
name: "Jane Smith",
email: "jane@example.com",
picture: "https://example.com/jane.jpg",
extensionBridgeEnabled: true,
})
})

Expand Down Expand Up @@ -869,7 +867,6 @@ describe("WebAuthService", () => {
name: "Jane Smith",
email: "jane@example.com",
picture: "https://example.com/jane.jpg",
extensionBridgeEnabled: false,
organizationId: "org_1",
organizationName: "Org 1",
organizationRole: "member",
Expand Down Expand Up @@ -920,7 +917,6 @@ describe("WebAuthService", () => {
name: "John Doe",
email: undefined,
picture: undefined,
extensionBridgeEnabled: true,
})
})
})
Expand Down Expand Up @@ -1045,7 +1041,6 @@ describe("WebAuthService", () => {
name: "Test User",
email: undefined,
picture: undefined,
extensionBridgeEnabled: true,
},
})
})
Expand Down
142 changes: 0 additions & 142 deletions packages/cloud/src/bridge/BaseChannel.ts

This file was deleted.

Loading
Loading