chore: remove unused field & make role field required
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ComponentPermission } from '../Component/ComponentPermission'
|
||||
import { ContentType, SubscriptionName } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { ComponentArea } from '../Component/ComponentArea'
|
||||
import { PermissionName } from '../Permission/PermissionName'
|
||||
import { FeatureIdentifier } from './FeatureIdentifier'
|
||||
@@ -12,7 +12,6 @@ type RoleFields = {
|
||||
role_name?: string
|
||||
|
||||
/** Statically populated. Non-influencing; used as a reference by other static consumers (such as email service) */
|
||||
availableInSubscriptions: SubscriptionName[]
|
||||
availableInRoles: string[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
import { GetFeatures, GetFeaturesForSubscription } from './Features'
|
||||
import { GetFeatures } from './Features'
|
||||
|
||||
describe('features', () => {
|
||||
it('all features should have availableInRoles populated', () => {
|
||||
@@ -9,11 +8,4 @@ describe('features', () => {
|
||||
expect(feature.availableInRoles !== undefined && feature.availableInRoles.length > 0).toBeTruthy()
|
||||
}
|
||||
})
|
||||
it('gets features for plus plan', () => {
|
||||
const features = GetFeaturesForSubscription(SubscriptionName.PlusPlan)
|
||||
|
||||
for (const feature of features) {
|
||||
expect(feature.availableInSubscriptions.includes(SubscriptionName.PlusPlan))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,16 +4,11 @@ import { serverFeatures } from '../Lists/ServerFeatures'
|
||||
import { clientFeatures } from '../Lists/ClientFeatures'
|
||||
import { GetDeprecatedFeatures } from '../Lists/DeprecatedFeatures'
|
||||
import { experimentalFeatures } from '../Lists/ExperimentalFeatures'
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
|
||||
export function GetFeatures(): FeatureDescription[] {
|
||||
return [...serverFeatures(), ...clientFeatures(), ...experimentalFeatures(), ...GetDeprecatedFeatures()]
|
||||
}
|
||||
|
||||
export function GetFeaturesForSubscription(subscription: SubscriptionName): FeatureDescription[] {
|
||||
return GetFeatures().filter((feature) => feature.availableInSubscriptions.includes(subscription))
|
||||
}
|
||||
|
||||
export function FindNativeFeature(identifier: FeatureIdentifier): FeatureDescription | undefined {
|
||||
return GetFeatures().find((f) => f.identifier === identifier)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user