Page MenuHomePhabricator

D12740.id42312.diff
No OneTemporary

D12740.id42312.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
@@ -1,5 +1,6 @@
// @flow
+import type { ClientDBMessageInfo } from './message-types.js';
import type { StoreOperations } from './store-ops-types.js';
export const outboundP2PMessageStatuses = Object.freeze({
@@ -40,6 +41,7 @@
// read operations
+getAllInboundP2PMessage: () => Promise<InboundP2PMessage[]>,
+getAllOutboundP2PMessage: () => Promise<OutboundP2PMessage[]>,
+ +getRelatedMessages: (messageID: string) => Promise<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
@@ -35,6 +35,7 @@
getAllOutboundP2PMessage: jest.fn(),
markOutboundP2PMessageAsSent: jest.fn(),
removeOutboundP2PMessagesOlderThan: jest.fn(),
+ getRelatedMessages: 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
@@ -9,6 +9,7 @@
// read operations
getAllInboundP2PMessage: commCoreModule.getAllInboundP2PMessage,
getAllOutboundP2PMessage: commCoreModule.getAllOutboundP2PMessage,
+ getRelatedMessages: commCoreModule.getRelatedMessages,
// 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
@@ -1,5 +1,6 @@
// @flow
+import type { ClientDBMessageInfo } from 'lib/types/message-types.js';
import type {
SQLiteAPI,
InboundP2PMessage,
@@ -34,6 +35,18 @@
return messages ? [...messages] : [];
},
+ async getRelatedMessages(messageID: string): Promise<ClientDBMessageInfo[]> {
+ const sharedWorker = await getCommSharedWorker();
+
+ const data = await sharedWorker.schedule({
+ type: workerRequestMessageTypes.GET_RELATED_MESSAGES,
+ messageID,
+ });
+ 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
Tue, Dec 24, 12:40 PM (8 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700045
Default Alt Text
D12740.id42312.diff (2 KB)

Event Timeline