Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3358024
D12854.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
D12854.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D12854: [lib] introduce message searching to `SQLiteAPI`
Attached
Detach File
Event Timeline
Log In to Comment