Page MenuHomePhabricator

D12852.id42708.diff
No OneTemporary

D12852.id42708.diff

diff --git a/web/shared-worker/worker/shared-worker.js b/web/shared-worker/worker/shared-worker.js
--- a/web/shared-worker/worker/shared-worker.js
+++ b/web/shared-worker/worker/shared-worker.js
@@ -258,7 +258,7 @@
message.messageID,
);
return {
- type: workerResponseMessageTypes.GET_RELATED_MESSAGES,
+ type: workerResponseMessageTypes.GET_MESSAGES,
messages: webMessageEntities.map(webMessageToClientDBMessageInfo),
};
} else if (
@@ -270,6 +270,17 @@
message.messageIDs,
),
};
+ } else if (message.type === workerRequestMessageTypes.SEARCH_MESSAGES) {
+ const webMessageEntities = sqliteQueryExecutor.searchMessages(
+ message.query,
+ message.threadID,
+ message.timestampCursor,
+ message.messageIDCursor,
+ );
+ return {
+ type: workerResponseMessageTypes.GET_MESSAGES,
+ messages: webMessageEntities.map(webMessageToClientDBMessageInfo),
+ };
}
// write operations
diff --git a/web/types/worker-types.js b/web/types/worker-types.js
--- a/web/types/worker-types.js
+++ b/web/types/worker-types.js
@@ -46,6 +46,7 @@
REMOVE_OUTBOUND_P2P_MESSAGES: 20,
GET_RELATED_MESSAGES: 21,
GET_OUTBOUND_P2P_MESSAGES_BY_ID: 22,
+ SEARCH_MESSAGES: 23,
});
export const workerWriteRequests: $ReadOnlyArray<number> = [
@@ -201,6 +202,14 @@
+messageIDs: $ReadOnlyArray<string>,
};
+export type SearchMessagesRequestMessage = {
+ +type: 23,
+ +query: string,
+ +threadID: string,
+ +timestampCursor: ?string,
+ +messageIDCursor: ?string,
+};
+
export type WorkerRequestMessage =
| PingWorkerRequestMessage
| InitWorkerRequestMessage
@@ -224,7 +233,8 @@
| MarkOutboundP2PMessageAsSentRequestMessage
| RemoveOutboundP2PMessagesRequestMessage
| GetRelatedMessagesRequestMessage
- | GetOutboundP2PMessagesByIDRequestMessage;
+ | GetOutboundP2PMessagesByIDRequestMessage
+ | SearchMessagesRequestMessage;
export type WorkerRequestProxyMessage = {
+id: number,
@@ -241,7 +251,7 @@
CALL_OLM_API_METHOD: 5,
GET_INBOUND_P2P_MESSAGES: 6,
GET_OUTBOUND_P2P_MESSAGES: 7,
- GET_RELATED_MESSAGES: 8,
+ GET_MESSAGES: 8,
});
export type PongWorkerResponseMessage = {
@@ -284,7 +294,7 @@
+outboundP2PMessages: $ReadOnlyArray<OutboundP2PMessage>,
};
-export type GetRelatedMessagesResponseMessage = {
+export type GetMessagesResponse = {
+type: 8,
+messages: $ReadOnlyArray<ClientDBMessageInfo>,
};
@@ -298,7 +308,7 @@
| CallOLMApiMethodResponseMessage
| GetInboundP2PMessagesResponseMessage
| GetOutboundP2PMessagesResponseMessage
- | GetRelatedMessagesResponseMessage;
+ | GetMessagesResponse;
export type WorkerResponseProxyMessage = {
+id?: number,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 3:59 AM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2578284
Default Alt Text
D12852.id42708.diff (2 KB)

Event Timeline