diff --git a/lib/types/avatar-types.js b/lib/types/avatar-types.js index f5e787a37..e155bcc19 100644 --- a/lib/types/avatar-types.js +++ b/lib/types/avatar-types.js @@ -1,27 +1,39 @@ // @flow export type EmojiAvatarDBContent = { +type: 'emoji', +emoji: string, +color: string, // hex, without "#" or "0x" }; export type ImageAvatarDBContent = { +type: 'image', +uploadID: string, }; export type ENSAvatarDBContent = { +type: 'ens', }; export type AvatarDBContent = | EmojiAvatarDBContent | ImageAvatarDBContent | ENSAvatarDBContent; export type UpdateUserAvatarRemoveRequest = { +type: 'remove' }; export type UpdateUserAvatarRequest = | AvatarDBContent | UpdateUserAvatarRemoveRequest; + +export type ClientEmojiAvatar = EmojiAvatarDBContent; +export type ClientImageAvatar = { + +type: 'image', + +uri: string, +}; +export type ClientENSAvatar = ENSAvatarDBContent; + +export type ClientAvatar = + | ClientEmojiAvatar + | ClientImageAvatar + | ClientENSAvatar; diff --git a/lib/types/user-types.js b/lib/types/user-types.js index d180898e9..6ecb57dfa 100644 --- a/lib/types/user-types.js +++ b/lib/types/user-types.js @@ -1,76 +1,84 @@ // @flow import type { DefaultNotificationPayload } from './account-types.js'; +import type { ClientAvatar } from './avatar-types.js'; import type { UserRelationshipStatus } from './relationship-types.js'; import type { UserInconsistencyReportCreationRequest } from './report-types.js'; export type GlobalUserInfo = { +id: string, +username: ?string, + +avatar?: ?ClientAvatar, }; export type GlobalAccountUserInfo = { +id: string, +username: string, + +avatar?: ?ClientAvatar, }; export type UserInfo = { +id: string, +username: ?string, +relationshipStatus?: UserRelationshipStatus, + +avatar?: ?ClientAvatar, }; export type UserInfos = { +[id: string]: UserInfo }; export type AccountUserInfo = { +id: string, +username: string, +relationshipStatus?: UserRelationshipStatus, + +avatar?: ?ClientAvatar, }; export type UserStore = { +userInfos: UserInfos, +inconsistencyReports: $ReadOnlyArray, }; export type RelativeUserInfo = { +id: string, +username: ?string, +isViewer: boolean, + +avatar?: ?ClientAvatar, }; export type OldLoggedInUserInfo = { +id: string, +username: string, +email: string, +emailVerified: boolean, }; export type LoggedInUserInfo = { +id: string, +username: string, +settings?: DefaultNotificationPayload, + +avatar?: ?ClientAvatar, }; export type LoggedOutUserInfo = { +id: string, +anonymous: true, }; export type OldCurrentUserInfo = OldLoggedInUserInfo | LoggedOutUserInfo; export type CurrentUserInfo = LoggedInUserInfo | LoggedOutUserInfo; export type PasswordUpdate = { +updatedFields: { +password?: ?string, }, +currentPassword: string, }; export type UserListItem = { +id: string, +username: string, +disabled?: boolean, +notice?: string, +alertText?: string, +alertTitle?: string, + +avatar?: ?ClientAvatar, };