Page MenuHomePhorge

D9111.1765060663.diff
No OneTemporary

Size
10 KB
Referenced Files
None
Subscribers
None

D9111.1765060663.diff

diff --git a/keyserver/src/creators/update-creator.js b/keyserver/src/creators/update-creator.js
--- a/keyserver/src/creators/update-creator.js
+++ b/keyserver/src/creators/update-creator.js
@@ -32,11 +32,7 @@
type RawUpdateInfo,
type CreateUpdatesResult,
} from 'lib/types/update-types.js';
-import type {
- UserInfos,
- LoggedInUserInfo,
- OldLoggedInUserInfo,
-} from 'lib/types/user-types.js';
+import type { UserInfos, LoggedInUserInfo } from 'lib/types/user-types.js';
import { promiseAll } from 'lib/utils/promises.js';
import createIDs from './id-creator.js';
@@ -527,7 +523,7 @@
messageInfosResult: ?FetchMessageInfosResult,
calendarResult: ?FetchEntryInfosBase,
entryInfosResult: ?RawEntryInfos,
- currentUserInfoResult: ?OldLoggedInUserInfo | LoggedInUserInfo,
+ currentUserInfoResult: LoggedInUserInfo,
};
async function updateInfosFromRawUpdateInfos(
viewer: Viewer,
diff --git a/keyserver/src/fetchers/user-fetchers.js b/keyserver/src/fetchers/user-fetchers.js
--- a/keyserver/src/fetchers/user-fetchers.js
+++ b/keyserver/src/fetchers/user-fetchers.js
@@ -17,9 +17,7 @@
import type {
UserInfos,
CurrentUserInfo,
- OldCurrentUserInfo,
LoggedInUserInfo,
- OldLoggedInUserInfo,
GlobalUserInfo,
} from 'lib/types/user-types.js';
import { ServerError } from 'lib/utils/errors.js';
@@ -279,9 +277,7 @@
return result.map(row => row.id.toString());
}
-async function fetchCurrentUserInfo(
- viewer: Viewer,
-): Promise<OldCurrentUserInfo | CurrentUserInfo> {
+async function fetchCurrentUserInfo(viewer: Viewer): Promise<CurrentUserInfo> {
if (!viewer.loggedIn) {
return ({ id: viewer.cookieID, anonymous: true }: CurrentUserInfo);
}
@@ -291,7 +287,7 @@
async function fetchLoggedInUserInfo(
viewer: Viewer,
-): Promise<OldLoggedInUserInfo | LoggedInUserInfo> {
+): Promise<LoggedInUserInfo> {
const userQuery = SQL`
SELECT u.id, u.username, u.avatar,
up.id AS upload_id, up.secret AS upload_secret
diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js
--- a/keyserver/src/responders/user-responders.js
+++ b/keyserver/src/responders/user-responders.js
@@ -66,7 +66,6 @@
type PasswordUpdate,
loggedOutUserInfoValidator,
loggedInUserInfoValidator,
- oldLoggedInUserInfoValidator,
userInfoValidator,
} from 'lib/types/user-types.js';
import {
@@ -261,10 +260,7 @@
tShape<RegisterResponse>({
id: t.String,
rawMessageInfos: t.list(rawMessageInfoValidator),
- currentUserInfo: t.union([
- oldLoggedInUserInfoValidator,
- loggedInUserInfoValidator,
- ]),
+ currentUserInfo: loggedInUserInfoValidator,
cookieChange: tShape({
threadInfos: t.dict(tID, rawThreadInfoValidator),
userInfos: t.list(userInfoValidator),
@@ -436,10 +432,7 @@
export const logInResponseValidator: TInterface<LogInResponse> =
tShape<LogInResponse>({
- currentUserInfo: t.union([
- loggedInUserInfoValidator,
- oldLoggedInUserInfoValidator,
- ]),
+ currentUserInfo: loggedInUserInfoValidator,
rawMessageInfos: t.list(rawMessageInfoValidator),
truncationStatuses: messageTruncationStatusesValidator,
userInfos: t.list(userInfoValidator),
diff --git a/keyserver/src/shared/state-sync/current-user-state-sync-spec.js b/keyserver/src/shared/state-sync/current-user-state-sync-spec.js
--- a/keyserver/src/shared/state-sync/current-user-state-sync-spec.js
+++ b/keyserver/src/shared/state-sync/current-user-state-sync-spec.js
@@ -1,18 +1,15 @@
// @flow
import { currentUserStateSyncSpec as libSpec } from 'lib/shared/state-sync/current-user-state-sync-spec.js';
-import type {
- CurrentUserInfo,
- OldCurrentUserInfo,
-} from 'lib/types/user-types.js';
+import type { CurrentUserInfo } from 'lib/types/user-types.js';
import type { ServerStateSyncSpec } from './state-sync-spec.js';
import { fetchCurrentUserInfo } from '../../fetchers/user-fetchers.js';
import type { Viewer } from '../../session/viewer.js';
export const currentUserStateSyncSpec: ServerStateSyncSpec<
- OldCurrentUserInfo | CurrentUserInfo,
- OldCurrentUserInfo | CurrentUserInfo,
+ CurrentUserInfo,
+ CurrentUserInfo,
> = Object.freeze({
fetch(viewer: Viewer) {
return fetchCurrentUserInfo(viewer);
diff --git a/lib/shared/state-sync/current-user-state-sync-spec.js b/lib/shared/state-sync/current-user-state-sync-spec.js
--- a/lib/shared/state-sync/current-user-state-sync-spec.js
+++ b/lib/shared/state-sync/current-user-state-sync-spec.js
@@ -3,21 +3,19 @@
import type { StateSyncSpec } from './state-sync-spec.js';
import {
type CurrentUserInfo,
- type OldCurrentUserInfo,
currentUserInfoValidator,
} from '../../types/user-types.js';
import { convertClientIDsToServerIDs } from '../../utils/conversion-utils.js';
import { ashoatKeyserverID } from '../../utils/validation-utils.js';
-export const currentUserStateSyncSpec: StateSyncSpec<
- OldCurrentUserInfo | CurrentUserInfo,
-> = Object.freeze({
- hashKey: 'currentUserInfo',
- convertClientToServerInfos(info: OldCurrentUserInfo | CurrentUserInfo) {
- return convertClientIDsToServerIDs(
- ashoatKeyserverID,
- currentUserInfoValidator,
- info,
- );
- },
-});
+export const currentUserStateSyncSpec: StateSyncSpec<CurrentUserInfo> =
+ Object.freeze({
+ hashKey: 'currentUserInfo',
+ convertClientToServerInfos(info: CurrentUserInfo) {
+ return convertClientIDsToServerIDs(
+ ashoatKeyserverID,
+ currentUserInfoValidator,
+ info,
+ );
+ },
+ });
diff --git a/lib/types/account-types.js b/lib/types/account-types.js
--- a/lib/types/account-types.js
+++ b/lib/types/account-types.js
@@ -20,7 +20,6 @@
type UserInfo,
type LoggedOutUserInfo,
type LoggedInUserInfo,
- type OldLoggedInUserInfo,
} from './user-types.js';
import type { PolicyType } from '../facts/policies.js';
import { values } from '../utils/objects.js';
@@ -64,7 +63,7 @@
export type RegisterResponse = {
id: string,
rawMessageInfos: $ReadOnlyArray<RawMessageInfo>,
- currentUserInfo: OldLoggedInUserInfo | LoggedInUserInfo,
+ currentUserInfo: LoggedInUserInfo,
cookieChange: {
threadInfos: { +[id: string]: RawThreadInfo },
userInfos: $ReadOnlyArray<UserInfo>,
@@ -135,7 +134,7 @@
};
export type LogInResponse = {
- +currentUserInfo: LoggedInUserInfo | OldLoggedInUserInfo,
+ +currentUserInfo: LoggedInUserInfo,
+rawMessageInfos: $ReadOnlyArray<RawMessageInfo>,
+truncationStatuses: MessageTruncationStatuses,
+userInfos: $ReadOnlyArray<UserInfo>,
diff --git a/lib/types/request-types.js b/lib/types/request-types.js
--- a/lib/types/request-types.js
+++ b/lib/types/request-types.js
@@ -23,8 +23,6 @@
import {
type CurrentUserInfo,
currentUserInfoValidator,
- type OldCurrentUserInfo,
- oldCurrentUserInfoValidator,
type AccountUserInfo,
accountUserInfoValidator,
} from './user-types.js';
@@ -109,7 +107,7 @@
+stateChanges?: Shape<{
+rawThreadInfos: RawThreadInfo[],
+rawEntryInfos: RawEntryInfo[],
- +currentUserInfo: CurrentUserInfo | OldCurrentUserInfo,
+ +currentUserInfo: CurrentUserInfo,
+userInfos: AccountUserInfo[],
+deleteThreadIDs: string[],
+deleteEntryIDs: string[],
@@ -131,9 +129,7 @@
tShape({
rawThreadInfos: t.maybe(t.list(rawThreadInfoValidator)),
rawEntryInfos: t.maybe(t.list(rawEntryInfoValidator)),
- currentUserInfo: t.maybe(
- t.union([currentUserInfoValidator, oldCurrentUserInfoValidator]),
- ),
+ currentUserInfo: t.maybe(currentUserInfoValidator),
userInfos: t.maybe(t.list(accountUserInfoValidator)),
deleteThreadIDs: t.maybe(t.list(tID)),
deleteEntryIDs: t.maybe(t.list(tID)),
diff --git a/lib/types/socket-types.js b/lib/types/socket-types.js
--- a/lib/types/socket-types.js
+++ b/lib/types/socket-types.js
@@ -43,8 +43,6 @@
userInfoValidator,
type CurrentUserInfo,
currentUserInfoValidator,
- type OldCurrentUserInfo,
- oldCurrentUserInfoValidator,
type LoggedOutUserInfo,
loggedOutUserInfoValidator,
} from './user-types.js';
@@ -209,14 +207,11 @@
export type ServerFullStateSync = {
...BaseFullStateSync,
- +currentUserInfo: CurrentUserInfo | OldCurrentUserInfo,
+ +currentUserInfo: CurrentUserInfo,
};
const serverFullStateSyncValidator = tShape<ServerFullStateSync>({
...baseFullStateSyncValidator.meta.props,
- currentUserInfo: t.union([
- currentUserInfoValidator,
- oldCurrentUserInfoValidator,
- ]),
+ currentUserInfo: currentUserInfoValidator,
});
export type ServerStateSyncFullSocketPayload = {
diff --git a/lib/types/update-types.js b/lib/types/update-types.js
--- a/lib/types/update-types.js
+++ b/lib/types/update-types.js
@@ -18,8 +18,6 @@
userInfosValidator,
type LoggedInUserInfo,
loggedInUserInfoValidator,
- type OldLoggedInUserInfo,
- oldLoggedInUserInfoValidator,
} from './user-types.js';
import { tNumber, tShape, tID } from '../utils/validation-utils.js';
@@ -312,17 +310,14 @@
+type: 7,
+id: string,
+time: number,
- +currentUserInfo: LoggedInUserInfo | OldLoggedInUserInfo,
+ +currentUserInfo: LoggedInUserInfo,
};
export const serverCurrentUserUpdateInfoValidator: TInterface<ServerCurrentUserUpdateInfo> =
tShape<ServerCurrentUserUpdateInfo>({
type: tNumber(updateTypes.UPDATE_CURRENT_USER),
id: t.String,
time: t.Number,
- currentUserInfo: t.union([
- loggedInUserInfoValidator,
- oldLoggedInUserInfoValidator,
- ]),
+ currentUserInfo: loggedInUserInfoValidator,
});
export type ServerUpdateInfo =
| AccountDeletionUpdateInfo
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
@@ -76,20 +76,6 @@
+avatar?: ?ClientAvatar,
};
-export type OldLoggedInUserInfo = {
- +id: string,
- +username: string,
- +email: string,
- +emailVerified: boolean,
-};
-export const oldLoggedInUserInfoValidator: TInterface<OldLoggedInUserInfo> =
- tShape<OldLoggedInUserInfo>({
- id: t.String,
- username: t.String,
- email: t.String,
- emailVerified: t.Boolean,
- });
-
export type LoggedInUserInfo = {
+id: string,
+username: string,
@@ -111,12 +97,6 @@
export const loggedOutUserInfoValidator: TInterface<LoggedOutUserInfo> =
tShape<LoggedOutUserInfo>({ id: t.String, anonymous: tBool(true) });
-export type OldCurrentUserInfo = OldLoggedInUserInfo | LoggedOutUserInfo;
-export const oldCurrentUserInfoValidator: TUnion<OldCurrentUserInfo> = t.union([
- oldLoggedInUserInfoValidator,
- loggedOutUserInfoValidator,
-]);
-
export type CurrentUserInfo = LoggedInUserInfo | LoggedOutUserInfo;
export const currentUserInfoValidator: TUnion<CurrentUserInfo> = t.union([
loggedInUserInfoValidator,

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 6, 10:37 PM (8 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5841157
Default Alt Text
D9111.1765060663.diff (10 KB)

Event Timeline