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
20 changes: 20 additions & 0 deletions src/platform/settings/composables/useSettingUI.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
import { useSettingStore } from '@/platform/settings/settingStore'
import type { SettingTreeNode } from '@/platform/settings/composables/useSettingSearch'
import { useBillingCapabilities } from '@/platform/billing/composables/useBillingCapabilities'

Check warning on line 13 in src/platform/settings/composables/useSettingUI.test.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Boundary violation

Import from zone 'settings/presentation' to zone 'billing/application' is not allowed. src/platform/settings/composables/useSettingUI.test.ts -> src/platform/billing/composables/useBillingCapabilities.ts Route the import through an allowed zone or restructure the dependency.
import { receiveServerFact } from '@/platform/serverFacts/serverFact'

Check warning on line 14 in src/platform/settings/composables/useSettingUI.test.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Boundary violation

Import from zone 'settings/presentation' to zone 'server-facts/domain/public' is not allowed. src/platform/settings/composables/useSettingUI.test.ts -> src/platform/serverFacts/serverFact.ts Route the import through an allowed zone or restructure the dependency.
import { useWorkspaceUI } from '@/platform/workspace/composables/useWorkspaceUI'

import { useSettingUI as useSettingUIComposable } from './useSettingUI'
Expand Down Expand Up @@ -49,6 +51,7 @@
}))

vi.mock(import('@/platform/workspace/composables/useWorkspaceUI'))
vi.mock(import('@/platform/billing/composables/useBillingCapabilities'))

Check warning on line 54 in src/platform/settings/composables/useSettingUI.test.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Boundary violation

Import from zone 'settings/presentation' to zone 'billing/application' is not allowed. src/platform/settings/composables/useSettingUI.test.ts -> src/platform/billing/composables/__mocks__/useBillingCapabilities.ts Route the import through an allowed zone or restructure the dependency.

interface MockSettingParams {
id: string
Expand Down Expand Up @@ -271,6 +274,23 @@
expect(findPanelByKey('workspace-allowlist')).toBeNull()
})

it('shows Members off Cloud when the server says the actor can manage them', () => {
env.state.isCloud = false
vi.mocked(useBillingCapabilities()).canManageMembers = computed(() =>
receiveServerFact('can_manage_members', true)
)

const { navGroups } = useSettingUI()
const workspaceItems = navGroups.value
.find((group) => group.title === 'Workspace')
?.items.map(({ id, label }) => ({ id, label }))

expect(workspaceItems).toEqual([
{ id: 'workspace', label: 'PlanCredits' },
{ id: 'workspace-members', label: 'Members' }
])
})

it('mounts the Billing tab on local when unified billing settings is on', () => {
env.state.isCloud = false
const flags = vi.mocked(useFeatureFlags().flags)
Expand Down
11 changes: 10 additions & 1 deletion src/platform/settings/composables/useSettingUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
import { useFeatureFlags } from '@/composables/useFeatureFlags'
import { useVueFeatureFlags } from '@/composables/useVueFeatureFlags'
import { useBillingCapabilities } from '@/platform/billing/composables/useBillingCapabilities'

Check warning on line 8 in src/platform/settings/composables/useSettingUI.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Boundary violation

Import from zone 'settings/presentation' to zone 'billing/application' is not allowed. src/platform/settings/composables/useSettingUI.ts -> src/platform/billing/composables/useBillingCapabilities.ts Route the import through an allowed zone or restructure the dependency.
import { pendingServerFact } from '@/platform/serverFacts/pendingServerFact'

Check warning on line 9 in src/platform/settings/composables/useSettingUI.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Boundary violation

Import from zone 'settings/presentation' to zone 'server-facts/domain/public' is not allowed. src/platform/settings/composables/useSettingUI.ts -> src/platform/serverFacts/pendingServerFact.ts Route the import through an allowed zone or restructure the dependency.
import { isCloud, isDesktop } from '@/platform/distribution/types'
import {
getSettingInfo,
Expand Down Expand Up @@ -53,6 +55,7 @@
) {
const { t } = useI18n()
const { isLoggedIn } = useCurrentUser()
const { canManageMembers } = useBillingCapabilities()
const settingStore = useSettingStore()
const activeCategory = ref<SettingTreeNode | null>(null)

Expand Down Expand Up @@ -212,7 +215,13 @@
const planPanel = flags.unifiedBillingSettingsEnabled
? billingPanel
: planCreditsPanel
const workspacePanels = isCloud ? [planPanel, membersPanel] : [planPanel]
const canViewMembers = pendingServerFact(
'BE-24066',
isCloud || canManageMembers.value
)
const workspacePanels = canViewMembers
? [planPanel, membersPanel]
: [planPanel]
return shouldShowWorkspaceAllowlist.value
? [...workspacePanels, allowlistPanel]
: workspacePanels
Expand Down
Loading