Page MenuHomePhabricator

D12854.diff
No OneTemporary

D12854.diff

diff --git a/lib/types/sqlite-types.js b/lib/types/sqlite-types.js
--- a/lib/types/sqlite-types.js
+++ b/lib/types/sqlite-types.js
@@ -48,6 +48,12 @@
+getOutboundP2PMessagesByID: (
ids: $ReadOnlyArray<string>,
) => Promise<Array<OutboundP2PMessage>>,
+ +searchMessages: (
+ query: string,
+ threadID: string,
+ timestampCursor: ?string,
+ messageIDCursor: ?string,
+ ) => Promise<Array<ClientDBMessageInfo>>,
// write operations
+removeInboundP2PMessages: (ids: $ReadOnlyArray<string>) => Promise<void>,
diff --git a/lib/utils/__mocks__/config.js b/lib/utils/__mocks__/config.js
--- a/lib/utils/__mocks__/config.js
+++ b/lib/utils/__mocks__/config.js
@@ -37,6 +37,7 @@
removeOutboundP2PMessagesOlderThan: jest.fn(),
getRelatedMessages: jest.fn(),
getOutboundP2PMessagesByID: jest.fn(),
+ searchMessages: jest.fn(),
},
});
diff --git a/native/database/sqlite-api.js b/native/database/sqlite-api.js
--- a/native/database/sqlite-api.js
+++ b/native/database/sqlite-api.js
@@ -11,6 +11,7 @@
getAllOutboundP2PMessages: commCoreModule.getAllOutboundP2PMessages,
getRelatedMessages: commCoreModule.getRelatedMessages,
getOutboundP2PMessagesByID: commCoreModule.getOutboundP2PMessagesByID,
+ searchMessages: commCoreModule.searchMessages,
// write operations
removeInboundP2PMessages: commCoreModule.removeInboundP2PMessages,
diff --git a/web/database/sqlite-api.js b/web/database/sqlite-api.js
--- a/web/database/sqlite-api.js
+++ b/web/database/sqlite-api.js
@@ -60,6 +60,25 @@
return messages ? [...messages] : [];
},
+ async searchMessages(
+ query: string,
+ threadID: string,
+ timestampCursor: ?string,
+ messageIDCursor: ?string,
+ ): Promise<ClientDBMessageInfo[]> {
+ const sharedWorker = await getCommSharedWorker();
+
+ const data = await sharedWorker.schedule({
+ type: workerRequestMessageTypes.SEARCH_MESSAGES,
+ query,
+ threadID,
+ timestampCursor,
+ messageIDCursor,
+ });
+ const messages: ?$ReadOnlyArray<ClientDBMessageInfo> = data?.messages;
+ return messages ? [...messages] : [];
+ },
+
// write operations
async removeInboundP2PMessages(ids: $ReadOnlyArray<string>): Promise<void> {
const sharedWorker = await getCommSharedWorker();

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 3:00 AM (21 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2578112
Default Alt Text
D12854.diff (2 KB)

Event Timeline