chore: enable vaults on free internal team user accounts (#2617)
This commit is contained in:
@@ -3,7 +3,7 @@ import { ComponentInterface, DecryptedItemInterface } from '@standardnotes/model
|
||||
import { FeatureStatus } from './FeatureStatus'
|
||||
import { SetOfflineFeaturesFunctionResponse } from './SetOfflineFeaturesFunctionResponse'
|
||||
import { NativeFeatureIdentifier } from '@standardnotes/features'
|
||||
import { Uuid } from '@standardnotes/domain-core'
|
||||
import { RoleName, Uuid } from '@standardnotes/domain-core'
|
||||
|
||||
export interface FeaturesClientInterface {
|
||||
getFeatureStatus(
|
||||
@@ -11,7 +11,7 @@ export interface FeaturesClientInterface {
|
||||
options?: { inContextOfItem?: DecryptedItemInterface },
|
||||
): FeatureStatus
|
||||
hasMinimumRole(role: string): boolean
|
||||
|
||||
hasRole(roleName: RoleName): boolean
|
||||
hasFirstPartyOfflineSubscription(): boolean
|
||||
setOfflineFeaturesCode(code: string): Promise<SetOfflineFeaturesFunctionResponse>
|
||||
hasOfflineRepo(): boolean
|
||||
|
||||
@@ -412,6 +412,10 @@ export class FeaturesService
|
||||
return Object.values(RoleName.NAMES).filter((role) => roles.includes(role))
|
||||
}
|
||||
|
||||
hasRole(roleName: RoleName): boolean {
|
||||
return this.onlineRoles.includes(roleName.value) || this.offlineRoles.includes(roleName.value)
|
||||
}
|
||||
|
||||
public hasMinimumRole(role: string): boolean {
|
||||
const sortedAllRoles = Object.values(RoleName.NAMES)
|
||||
|
||||
|
||||
@@ -133,7 +133,11 @@ export class FeaturesController extends AbstractViewController implements Intern
|
||||
|
||||
isVaultsEnabled(): boolean {
|
||||
const enabled = this.features.isExperimentalFeatureEnabled(NativeFeatureIdentifier.TYPES.Vaults)
|
||||
return featureTrunkVaultsEnabled() || enabled || this.features.hasMinimumRole(RoleName.NAMES.InternalTeamUser)
|
||||
return (
|
||||
featureTrunkVaultsEnabled() ||
|
||||
enabled ||
|
||||
this.features.hasRole(RoleName.create(RoleName.NAMES.InternalTeamUser).getValue())
|
||||
)
|
||||
}
|
||||
|
||||
isEntitledToSharedVaults(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user