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
F1714714: D7710.id.diff
Tue, May 7, 3:33 PM
F1713755: D7710.diff
Tue, May 7, 9:26 AM
Unknown Object (File)
Sun, May 5, 7:24 AM
Unknown Object (File)
Sun, May 5, 7:24 AM
Unknown Object (File)
Sun, May 5, 7:24 AM
Unknown Object (File)
Sun, May 5, 7:19 AM
Unknown Object (File)
Sun, May 5, 6:08 AM
Unknown Object (File)
Fri, May 3, 3:41 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