Page MenuHomePhabricator

D9893.diff
No OneTemporary

D9893.diff

diff --git a/keyserver/src/shared/state-sync/users-state-sync-spec.js b/keyserver/src/shared/state-sync/users-state-sync-spec.js
--- a/keyserver/src/shared/state-sync/users-state-sync-spec.js
+++ b/keyserver/src/shared/state-sync/users-state-sync-spec.js
@@ -1,7 +1,7 @@
// @flow
import { usersStateSyncSpec as libSpec } from 'lib/shared/state-sync/users-state-sync-spec.js';
-import type { UserInconsistencyReportCreationRequest } from 'lib/types/report-types.js';
+import type { ClientUserInconsistencyReportCreationRequest } from 'lib/types/report-types.js';
import type { UserInfos, UserInfo } from 'lib/types/user-types.js';
import { userInfoValidator } from 'lib/types/user-types.js';
import { values, hash, combineUnorderedHashes } from 'lib/utils/objects.js';
@@ -15,7 +15,7 @@
UserInfos,
$ReadOnlyArray<UserInfo>,
UserInfo,
- $ReadOnlyArray<UserInconsistencyReportCreationRequest>,
+ $ReadOnlyArray<ClientUserInconsistencyReportCreationRequest>,
> = Object.freeze({
fetch,
async fetchFullSocketSyncPayload(viewer: Viewer) {
diff --git a/lib/reducers/report-store-reducer.test.js b/lib/reducers/report-store-reducer.test.js
--- a/lib/reducers/report-store-reducer.test.js
+++ b/lib/reducers/report-store-reducer.test.js
@@ -7,8 +7,8 @@
import {
type ReportStore,
reportTypes,
- type MediaMissionReportCreationRequest,
- type ErrorReportCreationRequest,
+ type ClientMediaMissionReportCreationRequest,
+ type ClientErrorReportCreationRequest,
type EnabledReports,
type ClientThreadInconsistencyReportCreationRequest,
} from '../types/report-types.js';
@@ -31,7 +31,7 @@
loadingInfo,
};
-const mockErrorReport: ErrorReportCreationRequest = {
+const mockErrorReport: ClientErrorReportCreationRequest = {
type: reportTypes.ERROR,
platformDetails: { platform: 'web' },
errors: [],
@@ -53,7 +53,7 @@
id: '1-2',
};
-const mockMediaReport: MediaMissionReportCreationRequest = {
+const mockMediaReport: ClientMediaMissionReportCreationRequest = {
type: reportTypes.MEDIA_MISSION,
platformDetails: { platform: 'web' },
time: Date.now(),
diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js
--- a/lib/reducers/user-reducer.js
+++ b/lib/reducers/user-reducer.js
@@ -20,7 +20,7 @@
import { stateSyncSpecs } from '../shared/state-sync/state-sync-specs.js';
import { updateSpecs } from '../shared/updates/update-specs.js';
import type { BaseAction } from '../types/redux-types.js';
-import type { UserInconsistencyReportCreationRequest } from '../types/report-types.js';
+import type { ClientUserInconsistencyReportCreationRequest } from '../types/report-types.js';
import {
serverRequestTypes,
processServerRequestsActionType,
@@ -123,7 +123,7 @@
function reduceUserInfos(
state: UserStore,
action: BaseAction,
-): [UserStore, $ReadOnlyArray<UserInconsistencyReportCreationRequest>] {
+): [UserStore, $ReadOnlyArray<ClientUserInconsistencyReportCreationRequest>] {
if (
action.type === joinThreadActionTypes.success ||
action.type === newThreadActionTypes.success
diff --git a/lib/shared/state-sync/users-state-sync-spec.js b/lib/shared/state-sync/users-state-sync-spec.js
--- a/lib/shared/state-sync/users-state-sync-spec.js
+++ b/lib/shared/state-sync/users-state-sync-spec.js
@@ -6,8 +6,8 @@
import type { StateSyncSpec } from './state-sync-spec.js';
import type { AppState } from '../../types/redux-types';
import {
+ type ClientUserInconsistencyReportCreationRequest,
reportTypes,
- type UserInconsistencyReportCreationRequest,
} from '../../types/report-types.js';
import type { ProcessServerRequestAction } from '../../types/request-types.js';
import { type UserInfo, type UserInfos } from '../../types/user-types.js';
@@ -20,7 +20,7 @@
export const usersStateSyncSpec: StateSyncSpec<
UserInfos,
UserInfo,
- $ReadOnlyArray<UserInconsistencyReportCreationRequest>,
+ $ReadOnlyArray<ClientUserInconsistencyReportCreationRequest>,
> = Object.freeze({
hashKey: 'userInfos',
innerHashSpec: {
diff --git a/lib/types/report-types.js b/lib/types/report-types.js
--- a/lib/types/report-types.js
+++ b/lib/types/report-types.js
@@ -106,7 +106,6 @@
+preloadedState: AppState,
+currentState: AppState,
+actions: $ReadOnlyArray<BaseAction>,
- +id: string,
};
export type ThreadInconsistencyReportCreationRequest = {
...ThreadInconsistencyReportShape,
@@ -126,12 +125,10 @@
+mediaLocalID?: ?string, // deprecated
+messageServerID?: ?string,
+messageLocalID?: ?string,
- +id: string,
};
export type UserInconsistencyReportCreationRequest = {
...UserInconsistencyReportShape,
+type: 4,
- +id: string,
};
export type ReportCreationRequest =
| ErrorReportCreationRequest
@@ -158,6 +155,10 @@
+time: number,
};
+export type ClientErrorReportCreationRequest = {
+ ...ErrorReportCreationRequest,
+ +id: string,
+};
export type ClientThreadInconsistencyReportCreationRequest = {
...ClientThreadInconsistencyReportShape,
+type: 1,
@@ -168,13 +169,21 @@
+type: 2,
+id: string,
};
+export type ClientMediaMissionReportCreationRequest = {
+ ...MediaMissionReportCreationRequest,
+ +id: string,
+};
+export type ClientUserInconsistencyReportCreationRequest = {
+ ...UserInconsistencyReportCreationRequest,
+ +id: string,
+};
export type ClientReportCreationRequest =
- | ErrorReportCreationRequest
+ | ClientErrorReportCreationRequest
| ClientThreadInconsistencyReportCreationRequest
| ClientEntryInconsistencyReportCreationRequest
- | MediaMissionReportCreationRequest
- | UserInconsistencyReportCreationRequest;
+ | ClientMediaMissionReportCreationRequest
+ | ClientUserInconsistencyReportCreationRequest;
export type QueueReportsPayload = {
+reports: $ReadOnlyArray<ClientReportCreationRequest>,
diff --git a/lib/utils/reports-service.js b/lib/utils/reports-service.js
--- a/lib/utils/reports-service.js
+++ b/lib/utils/reports-service.js
@@ -8,6 +8,8 @@
import type {
ReportsServiceSendReportsRequest,
ReportsServiceSendReportsResponse,
+ ReportCreationRequest,
+ ClientReportCreationRequest,
} from '../types/report-types.js';
const REQUEST_TIMEOUT = 60 * 1000; // 60s
@@ -15,16 +17,19 @@
async function sendReports(
reports: ReportsServiceSendReportsRequest,
): Promise<ReportsServiceSendReportsResponse> {
- const reportsArray = Array.isArray(reports) ? reports : [reports];
+ const reportsArray: $ReadOnlyArray<ClientReportCreationRequest> =
+ Array.isArray(reports) ? reports : [reports];
if (reportsArray.length === 0) {
return { reportIDs: [] };
}
- const requestBody = reportsArray.map(clientReport => {
- const { id, ...report } = clientReport;
- return report;
- });
+ const requestBody: $ReadOnlyArray<ReportCreationRequest> = reportsArray.map(
+ clientReport => {
+ const { id, ...report } = clientReport;
+ return report;
+ },
+ );
const url = `${reportsServiceURL}${sendReportEndpoint.path}`;
const response = await fetchWithTimeout(url, {
method: sendReportEndpoint.method,
diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js
--- a/native/input/input-state-container.react.js
+++ b/native/input/input-state-container.react.js
@@ -73,7 +73,7 @@
import type { RawTextMessageInfo } from 'lib/types/messages/text.js';
import type { Dispatch } from 'lib/types/redux-types.js';
import {
- type MediaMissionReportCreationRequest,
+ type ClientMediaMissionReportCreationRequest,
reportTypes,
} from 'lib/types/report-types.js';
import { threadTypes } from 'lib/types/thread-types-enum.js';
@@ -1266,7 +1266,7 @@
ids: { localID: string, localMessageID: string, serverID: ?string },
mediaMission: MediaMission,
) {
- const report: MediaMissionReportCreationRequest = {
+ const report: ClientMediaMissionReportCreationRequest = {
type: reportTypes.MEDIA_MISSION,
time: Date.now(),
platformDetails: getConfig().platformDetails,
diff --git a/native/media/save-media.js b/native/media/save-media.js
--- a/native/media/save-media.js
+++ b/native/media/save-media.js
@@ -17,7 +17,7 @@
} from 'lib/types/media-types.js';
import {
reportTypes,
- type MediaMissionReportCreationRequest,
+ type ClientMediaMissionReportCreationRequest,
} from 'lib/types/report-types.js';
import { getConfig } from 'lib/utils/config.js';
import { getMessageForException } from 'lib/utils/errors.js';
@@ -104,7 +104,7 @@
const { uploadID, messageServerID, messageLocalID } = ids;
const uploadIDIsLocal = isLocalUploadID(uploadID);
- const report: MediaMissionReportCreationRequest = {
+ const report: ClientMediaMissionReportCreationRequest = {
type: reportTypes.MEDIA_MISSION,
time: Date.now(),
platformDetails: getConfig().platformDetails,

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 7:36 AM (18 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2694013
Default Alt Text
D9893.diff (8 KB)

Event Timeline