diff --git a/lib/shared/updates/delete-account-spec.js b/lib/shared/updates/delete-account-spec.js --- a/lib/shared/updates/delete-account-spec.js +++ b/lib/shared/updates/delete-account-spec.js @@ -11,7 +11,7 @@ AccountDeletionUpdateInfo, } from '../../types/update-types.js'; import type { UserInfos } from '../../types/user-types.js'; -import { tNumber, tShape } from '../../utils/validation-utils.js'; +import { tNumber, tShape, tUserID } from '../../utils/validation-utils.js'; export const deleteAccountSpec: UpdateSpec< AccountDeletionUpdateInfo, @@ -98,6 +98,6 @@ type: tNumber(updateTypes.DELETE_ACCOUNT), id: t.String, time: t.Number, - deletedUserID: t.String, + deletedUserID: tUserID, }), }); diff --git a/lib/shared/updates/update-user-spec.js b/lib/shared/updates/update-user-spec.js --- a/lib/shared/updates/update-user-spec.js +++ b/lib/shared/updates/update-user-spec.js @@ -9,7 +9,7 @@ UserRawUpdateInfo, UserUpdateData, } from '../../types/update-types.js'; -import { tNumber, tShape } from '../../utils/validation-utils.js'; +import { tNumber, tShape, tUserID } from '../../utils/validation-utils.js'; export const updateUserSpec: UpdateSpec< UserUpdateInfo, @@ -62,6 +62,6 @@ type: tNumber(updateTypes.UPDATE_USER), id: t.String, time: t.Number, - updatedUserID: t.String, + updatedUserID: tUserID, }), }); diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -35,7 +35,7 @@ import type { UserInfo, UserInfos } from './user-types.js'; import type { SpecialRole } from '../permissions/special-roles.js'; import { type ThreadEntity } from '../utils/entity-text.js'; -import { tID, tShape } from '../utils/validation-utils.js'; +import { tID, tShape, tUserID } from '../utils/validation-utils.js'; export type LegacyMemberInfo = { +id: string, @@ -45,7 +45,7 @@ }; export const legacyMemberInfoValidator: TInterface = tShape({ - id: t.String, + id: tUserID, role: t.maybe(tID), permissions: threadPermissionsInfoValidator, isSender: t.Boolean, diff --git a/lib/types/user-types.js b/lib/types/user-types.js --- a/lib/types/user-types.js +++ b/lib/types/user-types.js @@ -38,7 +38,7 @@ +avatar?: ?ClientAvatar, }; export const userInfoValidator: TInterface = tShape({ - id: t.String, + id: tUserID, username: t.maybe(t.String), relationshipStatus: t.maybe(userRelationshipStatusValidator), avatar: t.maybe(clientAvatarValidator), @@ -82,7 +82,7 @@ }; export const loggedInUserInfoValidator: TInterface = tShape({ - id: t.String, + id: tUserID, username: t.String, settings: t.maybe(defaultNotificationPayloadValidator), avatar: t.maybe(clientAvatarValidator),