diff --git a/lib/permissions/minimally-encoded-raw-thread-info-validators.js b/lib/permissions/minimally-encoded-raw-thread-info-validators.js --- a/lib/permissions/minimally-encoded-raw-thread-info-validators.js +++ b/lib/permissions/minimally-encoded-raw-thread-info-validators.js @@ -17,7 +17,6 @@ type LegacyRawThreadInfo, legacyMemberInfoValidator, legacyRawThreadInfoValidator, - clientLegacyRoleInfoValidator, legacyThreadCurrentUserInfoValidator, } from '../types/thread-types.js'; import { tBool, tID, tShape } from '../utils/validation-utils.js'; @@ -30,7 +29,8 @@ }); const roleInfoValidator: TInterface = tShape({ - ...clientLegacyRoleInfoValidator.meta.props, + id: tID, + name: t.String, minimallyEncoded: tBool(true), permissions: t.list(tHexEncodedRolePermission), specialRole: t.maybe(specialRoleValidator), diff --git a/lib/permissions/minimally-encoded-thread-permissions-test-data.js b/lib/permissions/minimally-encoded-thread-permissions-test-data.js --- a/lib/permissions/minimally-encoded-thread-permissions-test-data.js +++ b/lib/permissions/minimally-encoded-thread-permissions-test-data.js @@ -352,7 +352,6 @@ '015', '0a9', ], - isDefault: true, specialRole: specialRoles.DEFAULT_ROLE, }, }, diff --git a/lib/permissions/minimally-encoded-thread-permissions.test.js b/lib/permissions/minimally-encoded-thread-permissions.test.js --- a/lib/permissions/minimally-encoded-thread-permissions.test.js +++ b/lib/permissions/minimally-encoded-thread-permissions.test.js @@ -346,7 +346,6 @@ id: 'roleID', name: 'roleName', permissions: ['abc', 'def'], - isDefault: true, specialRole: specialRoles.DEFAULT_ROLE, }), ).toBe(true); diff --git a/lib/permissions/special-roles.test.js b/lib/permissions/special-roles.test.js --- a/lib/permissions/special-roles.test.js +++ b/lib/permissions/special-roles.test.js @@ -16,7 +16,6 @@ id: 'roleID', name: 'roleName', permissions: ['abc', 'def'], - isDefault: true, specialRole: specialRoles.DEFAULT_ROLE, }; const patchedRole = patchRoleInfoWithSpecialRole(role); @@ -29,7 +28,6 @@ id: 'roleID', name: 'Admins', permissions: ['abc', 'def'], - isDefault: false, specialRole: specialRoles.ADMIN_ROLE, }; const patchedRole = patchRoleInfoWithSpecialRole(role); @@ -42,7 +40,6 @@ id: 'roleID', name: 'BLAH', permissions: ['abc', 'def'], - isDefault: false, specialRole: null, }; const patchedRole = patchRoleInfoWithSpecialRole(role); @@ -84,7 +81,6 @@ id: '256|83795', name: 'Members', permissions: ['000', '010', '005', '015', '0a7'], - isDefault: true, specialRole: specialRoles.DEFAULT_ROLE, minimallyEncoded: true, }, @@ -131,7 +127,6 @@ '134', '156', ], - isDefault: false, specialRole: specialRoles.ADMIN_ROLE, minimallyEncoded: true, }, @@ -197,7 +192,6 @@ '015', '0a9', ], - isDefault: false, specialRole: null, minimallyEncoded: true, }, diff --git a/lib/reducers/calendar-filters-reducer.test.js b/lib/reducers/calendar-filters-reducer.test.js --- a/lib/reducers/calendar-filters-reducer.test.js +++ b/lib/reducers/calendar-filters-reducer.test.js @@ -49,7 +49,6 @@ id: '256|83795', name: 'Members', permissions: ['000', '010', '005', '015', '0a7'], - isDefault: true, specialRole: specialRoles.DEFAULT_ROLE, minimallyEncoded: true, }, @@ -57,7 +56,6 @@ id: '256|83796', name: 'Admins', permissions: ['000', '010', '005', '015', '0a7'], - isDefault: false, specialRole: specialRoles.ADMIN_ROLE, minimallyEncoded: true, }, @@ -108,7 +106,6 @@ id: '256|83816', name: 'Members', permissions: ['000', '010', '005', '015', '0a7'], - isDefault: true, specialRole: specialRoles.DEFAULT_ROLE, minimallyEncoded: true, }, diff --git a/lib/shared/thread-utils.test.js b/lib/shared/thread-utils.test.js --- a/lib/shared/thread-utils.test.js +++ b/lib/shared/thread-utils.test.js @@ -108,7 +108,6 @@ id: '83795', name: 'Members', permissions: ['000', '010', '005', '015', '0a7'], - isDefault: true, specialRole: specialRoles.DEFAULT_ROLE, minimallyEncoded: true, }, @@ -155,7 +154,6 @@ '134', '156', ], - isDefault: false, specialRole: specialRoles.ADMIN_ROLE, minimallyEncoded: true, }, diff --git a/lib/types/minimally-encoded-thread-permissions-types.js b/lib/types/minimally-encoded-thread-permissions-types.js --- a/lib/types/minimally-encoded-thread-permissions-types.js +++ b/lib/types/minimally-encoded-thread-permissions-types.js @@ -4,6 +4,7 @@ import _mapValues from 'lodash/fp/mapValues.js'; import type { ClientAvatar } from './avatar-types.js'; +import type { ThreadRolePermissionsBlob } from './thread-permission-types.js'; import type { ThreadType } from './thread-types-enum.js'; import type { LegacyMemberInfo, @@ -23,7 +24,9 @@ import type { ThreadEntity } from '../utils/entity-text.js'; export type RoleInfo = $ReadOnly<{ - ...ClientLegacyRoleInfo, + +id: string, + +name: string, + +permissions: ThreadRolePermissionsBlob, +minimallyEncoded: true, +permissions: $ReadOnlyArray, +specialRole: ?SpecialRole, @@ -40,8 +43,9 @@ } else if (roleIsAdminRole(roleInfo)) { specialRole = specialRoles.ADMIN_ROLE; } + const { isDefault, ...rest } = roleInfo; return { - ...roleInfo, + ...rest, minimallyEncoded: true, permissions: threadRolePermissionsBlobToBitmaskArray(roleInfo.permissions), specialRole, @@ -57,6 +61,7 @@ permissions: decodeThreadRolePermissionsBitmaskArray( minimallyEncodedRoleInfo.permissions, ), + isDefault: roleIsDefaultRole(minimallyEncodedRoleInfo), }; };