mirror of
https://github.com/standardnotes/server
synced 2026-10-20 21:03:36 -04:00
Revert "feat: include roles in offline features request (#418)"
This reverts commit 2e7fdd93dd.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import 'reflect-metadata'
|
||||
import { FeatureDescription } from '@standardnotes/features'
|
||||
import { RoleName } from '@standardnotes/domain-core'
|
||||
|
||||
import { GetUserFeatures } from './GetUserFeatures'
|
||||
import { UserRepositoryInterface } from '../../User/UserRepositoryInterface'
|
||||
import { User } from '../../User/User'
|
||||
@@ -23,9 +21,7 @@ describe('GetUserFeatures', () => {
|
||||
feature1 = { name: 'foobar' } as jest.Mocked<FeatureDescription>
|
||||
featureService = {} as jest.Mocked<FeatureServiceInterface>
|
||||
featureService.getFeaturesForUser = jest.fn().mockReturnValue([feature1])
|
||||
featureService.getFeaturesForOfflineUser = jest
|
||||
.fn()
|
||||
.mockReturnValue({ features: [feature1], roles: [RoleName.NAMES.ProUser] })
|
||||
featureService.getFeaturesForOfflineUser = jest.fn().mockReturnValue([feature1])
|
||||
})
|
||||
|
||||
it('should fail if a user is not found', async () => {
|
||||
@@ -54,8 +50,11 @@ describe('GetUserFeatures', () => {
|
||||
it('should return offline user features', async () => {
|
||||
expect(await createUseCase().execute({ email: '[email protected]', offline: true })).toEqual({
|
||||
success: true,
|
||||
features: [{ name: 'foobar' }],
|
||||
offlineRoles: [RoleName.NAMES.ProUser],
|
||||
features: [
|
||||
{
|
||||
name: 'foobar',
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -15,12 +15,11 @@ export class GetUserFeatures implements UseCaseInterface {
|
||||
|
||||
async execute(dto: GetUserFeaturesDto): Promise<GetUserFeaturesResponse> {
|
||||
if (dto.offline) {
|
||||
const { features, roles } = await this.featureService.getFeaturesForOfflineUser(dto.email)
|
||||
const userFeatures = await this.featureService.getFeaturesForOfflineUser(dto.email)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
features,
|
||||
offlineRoles: roles,
|
||||
features: userFeatures,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { FeatureDescription } from '@standardnotes/features'
|
||||
|
||||
import { Role } from './../../Role/Role'
|
||||
|
||||
export type GetUserFeaturesResponse =
|
||||
| {
|
||||
success: true
|
||||
features: FeatureDescription[]
|
||||
offlineRoles?: Role[]
|
||||
userUuid?: string
|
||||
}
|
||||
| {
|
||||
|
||||
Reference in New Issue
Block a user