Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3379808
D12852.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12852.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 7:23 PM (20 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594680
Default Alt Text
D12852.diff (2 KB)
Attached To
Mode
D12852: [web] introduce message searching to shared worker
Attached
Detach File
Event Timeline
Log In to Comment