Page MenuHomePhabricator

[keyserver] Introduce report, message and thread responder validators
ClosedPublic

Authored by michal on May 4 2023, 3:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 9:10 AM
Unknown Object (File)
Thu, Nov 21, 2:09 AM
Unknown Object (File)
Wed, Nov 20, 8:16 AM
Unknown Object (File)
Mon, Oct 28, 8:38 AM
Unknown Object (File)
Oct 7 2024, 7:03 AM
Unknown Object (File)
Oct 2 2024, 3:28 PM
Unknown Object (File)
Sep 28 2024, 3:34 PM
Unknown Object (File)
Sep 28 2024, 3:34 PM
Subscribers

Details

Summary

Introduce remaining api responder validators and tests for them.

Depends on D7709

Test Plan

yarn jest

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

michal requested review of this revision.May 4 2023, 4:01 AM
keyserver/src/responders/message-responders.js
72–73
export type SendMessageResponse = {
  +newMessageInfo: RawMessageInfo,
};
129–134
export type FetchMessageInfosResponse = {
  +rawMessageInfos: $ReadOnlyArray<RawMessageInfo>,
  +truncationStatuses: MessageTruncationStatuses,
  +userInfos: UserInfos,
};
324–327
export type SendEditMessageResponse = {
  +newMessageInfos: $ReadOnlyArray<RawMessageInfo>,
};
413–417
export type FetchPinnedMessagesResult = {
  +pinnedMessages: $ReadOnlyArray<RawMessageInfo>,
};
keyserver/src/responders/report-responders.js
136–138
export type ReportCreationResponse = {
  +id: string,
};
211–215
export type FetchErrorReportInfosResponse = {
  +reports: $ReadOnlyArray<ReportInfo>,
  +userInfos: $ReadOnlyArray<UserInfo>,
};
keyserver/src/responders/thread-responders.js
66–72
export type LeaveThreadResult = {
  +threadInfos?: { +[id: string]: RawThreadInfo },
  +updatesResult: {
    +newUpdates: $ReadOnlyArray<ServerUpdateInfo>,
  },
};
92–100
export type ChangeThreadSettingsResult = {
  +threadInfo?: RawThreadInfo,
  +threadInfos?: { +[id: string]: RawThreadInfo },
  +updatesResult: {
    +newUpdates: $ReadOnlyArray<ServerUpdateInfo>,
  },
  +newMessageInfos: $ReadOnlyArray<RawMessageInfo>,
};
186–195
export type NewThreadResponse = {
  +updatesResult: {
    +newUpdates: $ReadOnlyArray<ServerUpdateInfo>,
  },
  +newMessageInfos: $ReadOnlyArray<RawMessageInfo>,
  +newThreadInfo?: RawThreadInfo,
  +userInfos: UserInfos,
  +newThreadID?: string,
};
215–225
export type ThreadJoinResult = {
  threadInfos?: { +[id: string]: RawThreadInfo },
  updatesResult: {
    newUpdates: $ReadOnlyArray<ServerUpdateInfo>,
  },
  rawMessageInfos: $ReadOnlyArray<RawMessageInfo>,
  truncationStatuses: MessageTruncationStatuses,
  userInfos: UserInfos,
  rawEntryInfos?: ?$ReadOnlyArray<RawEntryInfo>,
};
246–249
export type ThreadFetchMediaResult = {
  +media: $ReadOnlyArray<Media>,
};
264–268
export type ToggleMessagePinResult = {
  +newMessageInfos: $ReadOnlyArray<RawMessageInfo>,
  +threadID: string,
};
tomek requested changes to this revision.May 5 2023, 12:18 AM
tomek added inline comments.
keyserver/src/responders/report-responders.js
137

Are you really sure that this shouldn't be tID?

lib/types/report-types.js
194

Should this id be specific to a keyserver?

This revision now requires changes to proceed.May 5 2023, 12:18 AM

Fix one test that was being skipped by mistake

I've talked with @ashoat about report ids, and in the future, we probably will send them to some centralized server, so we don't need to convert ids or payloads. Currently the ids aren't used anywhere on the client side (except for being displayed in an alert once).

I've talked with @ashoat about report ids, and in the future, we probably will send them to some centralized server, so we don't need to convert ids or payloads.

More context on this in ENG-2102

Currently the ids aren't used anywhere on the client side (except for being displayed in an alert once).

Since the reports are only for devs to examine, it's not very important for us to worry about the IDs inside the report. As for the IDs that represent reports, these are mostly only used on the server side, with the exception of one inactive endpoint.

This revision is now accepted and ready to land.May 5 2023, 7:47 AM