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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const fieldValidation =

type Args = {
debug?: boolean
isDraftsEnabled?: boolean
isAutosaveEnabled?: boolean
name: string
overrides?: RootTenantFieldConfigOverrides
tenantsArrayFieldName: string
Expand All @@ -43,7 +43,7 @@ type Args = {
export const tenantField = ({
name = defaults.tenantFieldName,
debug,
isDraftsEnabled,
isAutosaveEnabled,
overrides: _overrides = {},
tenantsArrayFieldName = defaults.tenantsArrayFieldName,
tenantsArrayTenantFieldName = defaults.tenantsArrayTenantFieldName,
Expand Down Expand Up @@ -104,7 +104,7 @@ export const tenantField = ({
})
return isValidTenant ? tenantFromCookie : null
}
if (req.user && isDraftsEnabled) {
if (req.user && isAutosaveEnabled) {
const userTenants = getUserTenantIDs(req.user, {
tenantsArrayFieldName,
tenantsArrayTenantFieldName,
Expand Down
10 changes: 6 additions & 4 deletions packages/plugin-multi-tenant/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,11 @@ export const multiTenantPlugin =
tenantField({
name: tenantFieldName,
debug: pluginConfig.debug,
isDraftsEnabled: Boolean(
isAutosaveEnabled: Boolean(
collection.versions &&
typeof collection.versions === 'object' &&
collection.versions.drafts,
typeof collection.versions.drafts === 'object' &&
Boolean(collection.versions.drafts.autosave),
),
overrides: pluginConfig.collections[collection.slug]?.tenantFieldOverrides
? pluginConfig.collections[collection.slug]?.tenantFieldOverrides
Expand Down Expand Up @@ -381,10 +382,11 @@ export const multiTenantPlugin =
tenantField({
name: tenantFieldName,
debug: pluginConfig.debug,
isDraftsEnabled: Boolean(
isAutosaveEnabled: Boolean(
collection.versions &&
typeof collection.versions === 'object' &&
collection.versions.drafts,
typeof collection.versions.drafts === 'object' &&
Boolean(collection.versions.drafts.autosave),
),
overrides: pluginConfig.collections[collection.slug]?.tenantFieldOverrides
? pluginConfig.collections[collection.slug]?.tenantFieldOverrides
Expand Down